

/*****************************************************************************
*******   VALUE TB - DO FILE FOR POOLING COST DATA ACROSS 5 COUNTRIES  *******
******************************************************************************/

*Created by: sedona Sweeney, London School of Hygiene and Tropical Medicine
*Last updated 18 February 2021

/* Prepping the folder for analysis and setting the file pathways to access the data entry files */

		cd "C:\Users\phpusswe\Dropbox\lshtm/Value TB/Value TB/Value TB/Data/3rd Review - Sedona & Anna" /// <-- change this directory when working from a different computer
		

		clear all
		set more off
		cap ssc install strip
		local c_date = c(current_date)
		local date_string = subinstr("`c_date'", " " , "", .)
		capture mkdir "Analysis/`date_string'"
		capture mkdir "Analysis/`date_string'/facilityfiles"

*		capture erase "Analysis/`date_string'/pooled dataset_patient.dta"
*		capture erase "Analysis/`date_string'/pooled dataset_outputs.dta"
*		capture erase "Analysis/`date_string'/pooled dataset_outputs_long_detail.dta"
*		capture erase "Analysis/`date_string'/pooled dataset_outputs_long_summary.dta"
*		capture erase "Analysis/`date_string'/pooled dataset_patient.dta"
*		capture erase "Analysis/`date_string'/pooled dataset_treatcollapsed.dta"

		local dir_Ethiopia_new "C:\Users\phpusswe\Dropbox\lshtm\VALUE TB\_ethiopia\VALUE-TB Ethiopia\Data Entry\Appendix_12July2021"
		local dir_Ethiopia_old "C:\Users\phpusswe\Dropbox\lshtm\VALUE TB\_ethiopia\VALUE-TB Ethiopia\Data Entry\Latest-w-diagnosis_10Nov2020"
		
		local dir_Georgia_new "C:\Users\phpusswe\Dropbox\lshtm\VALUE TB\_georgia\VALUE-TB Georgia\Data entry files\Cleaned data\Files for analysis\Final dataset_SS16Dec2020"
		local dir_Georgia_old "C:\Users\phpusswe\Dropbox\lshtm\VALUE TB\_georgia\VALUE-TB Georgia\Data entry files\Cleaned data\Files for analysis\Appendix_4NovNS2020"
		
		local dir_India_new "C:\Users\phpusswe\Dropbox\lshtm\VALUE TB\DET Value TB Oct 20\IND\Dec 2020 Updates"
		local dir_India_old "C:\Users\phpusswe\Dropbox\lshtm\VALUE TB\DET Value TB Oct 20\IND\Appendix_1Nov2020NS"
		
		local dir_Kenya_old "C:\Users\phpusswe\Dropbox\lshtm\VALUE TB\_kenya\VALUE-TB Kenya\Workbooks-March 2020\Appendix_3Nov2020NS"
		local dir_Kenya_new "C:\Users\phpusswe\Dropbox\lshtm\VALUE TB\_kenya\VALUE-TB Kenya\Workbooks-March 2020\Jan 2021 Updates EB"
		
		local dir_Philippines_old "C:\Users\phpusswe\Dropbox\lshtm\VALUE TB\DET Value TB Oct 20\PH\Appendix_1Nov2020NS"
		local dir_Philippines_new "C:\Users\phpusswe\Dropbox\lshtm\VALUE TB\DET Value TB Oct 20\PH\Jan 2021 Updates EB"

/*

****************************************************************************
****************************************************************************
*******   Compiling and cleaning the pooled dataset - OUTPUT COSTS   *******
****************************************************************************
****************************************************************************

/*The following nested loops import data from Excel files, clean up variable naming and labelling, and pool all datasets together
Before running this Do File, place all completed Excel sheets into the following folder: Complete data for pooling/Excel Files/... 
Make sure there are no spaces in file names - follow naming convention in list below*/

		
		foreach cdirs in Philippines Georgia Ethiopia India Kenya { /*Philippines Georgia Ethiopia India Kenya*/
				
		local files: dir "`dir_`cdirs'_new'" files "*.xlsx", respectcase nofail  //this is the list of Excel files in the above folder
		local new: subinstr local files ".xlsx" "", all   //scrubs the extension so that we can use it below

		foreach dataset in `new' {

			
			preserve
			***IMPORTING AND RENAMING VARIABLES
			di "`dataset'"
			quietly {
				import excel "`dir_`cdirs'_new'/`dataset'.xlsx", sheet("Dataset output") cellrange(A5:DC335) firstrow clear 
				
			/* importing file */ 

			local country = proper(fc_country)
			local fc_name = fc_name
			gen oldnew = "new"
			
			foreach var in fc_clinicalstaff_FTE fc_supportstaff_FTE fc_totalstaff_FTE fc_opvisits_total fc_opvisits_TB {
							cap confirm string variable `var'
							if !_rc {
								replace `var' = "." if `var' == "no data" | `var' == "n/a" 
							destring `var', replace force
			}
			}
							
							save "Analysis/`date_string'/facilityfiles/`country'_`fc_name'_outputs_new.dta", replace 
					
				restore
				append using "Analysis/`date_string'/facilityfiles/`country'_`fc_name'_outputs_new.dta", force
				sa "Analysis/`date_string'/pooled dataset_outputs.dta", replace  
			}
		}
		}
		
		

	use "Analysis/`date_string'/pooled dataset_outputs.dta", clear
	
				***CLEANING
				/* replacing methods variables so that observations that are not applicable are recorded as missing rather than as string values */
				
				replace fc_country = proper(fc_country)
				sort fc_country fc_name 
								
								
				foreach metvars of varlist met_stafftime_obs met_stafftime_int met_stafftime_tmst met_stafftime_ass met_equip_obs met_equip_int met_supp_obs met_supp_int {
					quietly replace `metvars' = "" if `metvars' == ".NA" | `metvars' == "'.NA"
					cap destring `metvars', replace ignore(`"%"')
					} 
					
				/* replacing total costs as zero if this intervention was not observed in the facility */
				egen totalcost = rowtotal(cost_total_bldgs cost_total_equip_med cost_total_equip_other cost_total_furniture cost_total_vehicles cost_total_training cost_total_staff_clin cost_total_staff_support cost_total_staff_vol cost_total_supplies_med cost_total_drugs cost_total_supplies_other cost_total_maintenance cost_total_utilities cost_total_transport cost_total_food cost_total_other), missing
				drop if totalcost == 0 & servicestatistics == 0
				drop totalcost
					

				drop if output == "" 
				rename output originaloutputdescription
				gen output = originaloutputdescription
				gen output_pop2 = ""
				
				
				quietly {
				replace output = "Audiometry" if originaloutputdescription == "Audiometry test"
				replace output = "Biochemistry" if originaloutputdescription == "Biochemistry (ALT, AST, Bilirubin, Creatinine)"
				replace output = "Blood sugar" if originaloutputdescription == "Blood Sugar Test" | output == "Fasting Blood Sugar" | output == "Glucose (RBS)"
				replace output = "Body fluids analysis" if output == "Body fluid analysis (children)" | output == "Body Fluids"
			replace output = "Contact tracing" if originaloutputdescription == "Community screening visit - contact tracing" | originaloutputdescription == "Contact tracing_phone calls" | originaloutputdescription == "Contact tracing_ phone calls" | originaloutputdescription == "Contact tracing_phone call"
					replace outputgroup = "OT" if output == "Contact tracing"
					replace output_pop2 = "Phone call" if originaloutputdescription ==  "Contact tracing_phone calls" | originaloutputdescription == "Contact tracing_ phone calls" | originaloutputdescription == "Contact tracing_phone call"
					replace output_pop2 = "Home visit" if originaloutputdescription == "Community screening visit - contact tracing"
				
				replace output = "Inpatient bedday" if output == "DR-TB inpatient bedday" | output == "inpatient bedday_diagnosis" | output  == "Inpatient bedday_diagnosis" | output == "Inpatient bedday_DS" | output == "DS-TB inpatient bedday" | output == "Inpatient bed-day DS-TB" | output == "Inpatient bedday_DS-TB" | output == "Inpatient bedday_HIV/TB" | output == "Inpatient bedday_MDR" | output == "Inpatient bedday_treatment"
					replace output_pop2 = "DSTB" if originaloutputdescription ==  "Inpatient bedday_DS" | originaloutputdescription == "DS-TB inpatient bedday" | originaloutputdescription == "Inpatient bed-day DS-TB" | originaloutputdescription == "Inpatient bedday_DS-TB" 
					replace output_pop2 = "MDRTB" if originaloutputdescription ==  "DR-TB inpatient bedday" | originaloutputdescription == "Inpatient bedday_MDR"
					replace output_pop2 = "diagnosis" if originaloutputdescription ==  "inpatient bedday_diagnosis" | originaloutputdescription  == "Inpatient bedday_diagnosis"
					replace output_pop2 = "treatment" if originaloutputdescription == "Inpatient bedday_treatment"
				replace output = "DST_FL_liquid" if output == "DST for FL, (4 drugs -H,R,E,S), liquid media"
				replace output = "DST_FL_solid" if output == "DST for FL, (4 drugs -H,R,E,S), solid media"
				replace output = "DST_SL_solid" if output == "DST for SL, (fluoroquinolone injectables), solid media"
				replace output = "DST_SL_liquid" if output == "DST for SL, (fluoroquinolone injectables), liquid media" 
				replace output = "ECG" if output == "ECG, paper recording"
				replace output = "Electrolyte test" if output == "Electrolites" | output == "Electrolytes" | output == "Electrolytes panel test (potassium, calcium, magnesium, sodium, etc.)"
				replace output = "Full haemogram" if output == "Full haemogram (RBC, WBC and platelet) tests"
				replace output = "HB estimation" if output == "Hemoglobin estimation" | output == "Hgb/HCT" | output == " HB estimation"
				replace output = "LAM" if output == "LAM - Rapid antibody or antigen detection tests for TB"
				replace output = "Liver function test" if output == " Liver Function Tests (LFTs)" | output == "Liver Function Tests (LFTs)"
				replace output = "LPA" if output == "LPA - direct (1st & 2nd line)" | output == "LPA - FLD" | output == "LPA - SLD" 
					replace output_pop2 = "FLD" if originaloutputdescription == "LPA - FLD"
					replace output_pop2 = "SLD" if originaloutputdescription == "LPA = SLD"
				replace output = "LTFU tracing" if output == "Lost to follow-up tracing_home visit" | output == "Lost to follow-up tracing per person on contact list (phone calls)" | output == "Community other visit - LFU tracing"
					replace output_pop2 = "Phone call" if originaloutputdescription == "Lost to follow-up tracing per person on contact list (phone calls)"
					replace output_pop2 = "Home visit" if originaloutputdescription == "Lost to follow-up tracing_home visit" |  originaloutputdescription == "Community other visit - LFU tracing"
				replace output = "Outpatient adherence support visit" if output == "Outpatient adherence support" | output == "Outpatient Adherence support visit"
				replace output = "Outpatient other visit" if output == "Outpatient post treatment follow-up visit - with tests (for treatment and prevention)" | output == "Outpatient follow-up visit"
				replace output = "Outpatient screening visit" if output == "Outpatient screening visit_MCH"
					replace output_pop2 = "MCH" if originaloutputdescription == "Outpatient screening visit_MCH"
			
			replace output = "Outpatient treatment visit" if output == "Outpatient treatment visit_MDR" | output == "DOT visit by MDR patient" | output == "Outpatient treatment visit_DOT" | output == "visit for collecting medicine" | output == "visit for collecting medicines" | output == "Visit for collecting medicines" | output == "Visit for collecting medicines at discharge" | output == "Outpatient treatment visit_LTBI" | output == "Outpatient treatment_VOT" | output == "Visit for injection" | output == "visit for treatment" | output == "Vist for Injection" | output == "visit for collecting medicines" | output == "visit for injection" 
					replace output_pop2 = "DOT" if originaloutputdescription == "DOT visit by MDR patient" | originaloutputdescription == "Outpatient treatment visit_DOT" 
					replace output_pop2 = "MDR" if originaloutputdescription == "Outpatient treatment visit_MDR" 
					replace output_pop2 = "collecting meds" if originaloutputdescription == "visit for collecting medicine" | originaloutputdescription == "visit for collecting medicines" | originaloutputdescription == "visit for collecting medicines" | originaloutputdescription == "Visit for collecting medicines at discharge" 
					replace output_pop2 = "VOT" if originaloutputdescription == "Outpatient treatment_VOT"
					replace output_pop2 = "injection" if originaloutputdescription == "Vist for Injection" | originaloutputdescription == "Visit for injection" | originaloutputdescription == "visit for injection"
					replace output_pop2 = "LTBI" if originaloutputdescription == "Outpatient treatment visit_LTBI" 
				replace output = "Phone consultation" if output == "Phone consultation_Doctor-Nurse"
				replace output = "Pregnancy test" if output == "Pregnancy" | output == "Pregnancy Test"
				replace output = "Protein" if output == "Sr. Protein" | output == "total Protein"
				replace output = "Renal function test" if output == "Renal Function Tests (RFTs)" | output == " Renal Function Tests (RFTs)"
				replace output = "Sputum culture" if output == "TB Culture" | output == "Culture - liquid media [e.g.: MB/Bact Alert, Bactec MGIT 960]" | output == "Culture - solid medium [e.g.: Lowenstein-Jensen, Ogawa or Stonebrink]"
				replace output_pop2 = "Liquid media" if originaloutputdescription == "Culture - liquid media [e.g.: MB/Bact Alert, Bactec MGIT 960]"
				replace output_pop2 = "Solid media" if originaloutputdescription == "Culture - solid medium [e.g.: Lowenstein-Jensen, Ogawa or Stonebrink]"
				
				replace output = "Sputum collection" if output == "Gene Xpert (sent out)" | output == "Smear ZN (sent out)" | output == "Sputum Collection" | output == "Sputum Collection (for Culture and DST)" | output == "Sputum Collection (for Culture and LPA)" | output == "Sputum Collection (for LPA)" | output == "Smear induction" | output == "Sputum for Xpert (referral)" | output == "Smear preparation" | output == "Sputum Collection (for DST)"
					replace output_pop2 = "Xpert" if originaloutputdescription == "Gene Xpert (sent out)" | output == "Sputum for Xpert (referral)"
					replace output_pop2 = "Smear ZN" if originaloutputdescription == "Smear ZN (sent out)" | originaloutputdescription == "Smear preparation" 
					replace output_pop2 = "DST" if originaloutputdescription == "Sputum Collection (for DST)"
					replace output_pop2 = "Culture & DST" if originaloutputdescription == "Sputum Collection (for Culture and DST)"
					replace output_pop2 = "Culture & LPA" if originaloutputdescription == "Sputum Collection (for Culture and LPA)"
					replace output_pop2 = "LPA" if originaloutputdescription == "Sputum Collection (for LPA)"
				replace output = "Patient support" if output == "Patient support during diagnosis - vouchers" | output == "Patient support during treatment - vouchers"
					replace output_pop2 = "Diagnosis" if originaloutputdescription == "Patient support during diagnosis - vouchers" 
					replace output_pop2 = "Treatment" if originaloutputdescription == "Patient support during treatment - vouchers"
				replace output = "Ultrasound" if output == "Ultrasound (EPTB)" | output == "cardio ultrasound"
				replace output = "Urinalysis" if output == "Urine analysis"
				replace output = "Viral load" if output == "Viral Load"
				
				replace output = subinstr(output,"]","",.)
				replace output = subinstr(output,",","",.)
				replace output = subinstr(output,"/","",.)
				replace output = subinstr(output,":","",.)
				replace output = subinstr(output,"[","",.)
				replace output = subinstr(output,"-","",.)
				replace output = subinstr(output,"(","",.)
				replace output = subinstr(output,")","",.)
				replace output = subinword(output,"Outpatient", "OP",1)   
				replace output = subinword(output,"Outtpatient", "OP",1)  
				replace output = subinword(output,"Inpatient", "IP",1)   
				replace output = subinword(output,"Community", "CM",1)   
				replace output = subinword(output,"Lost to followup", "LTFU",1)   
				replace output = subinstr(output,"e.g.", "",.)   
				replace output = subinword(output,"during", "_",1)   
				replace output = subinstr(output,"Visitfor","",1)
				replace output = subinstr(output,"visitfor","",1)
				replace output = subinstr(output,"for","_",1)
				replace output = subinstr(output,"medicine","meds",1)
				replace output = subinstr(output,"Losttofollowup","LTFU",1)
				replace output = subinstr(output,"Patient support","Support",1)
				replace output = subinstr(output," and ","&",1)
				replace output = subinstr(output,"_ ", "_",.)   
				replace output = subinstr(output," _", "_",.)   
				replace output = subinstr(output,"  ", " ",.)   
				replace output = substr(output,1,30)
				}
		
		sort fc_country fc_name 
		
/* This section generates USD equivalents for costs.  
The exchange rates used are historical exchange rates from June 1 of the data collection year.
Please replace as necessary if a different exchange rate is more appropriate */		


			gen currency = "KES" if fc_country == "Kenya"
			gen currencyyear_collection = 2018 if fc_country == "Kenya"
			gen met_xr = (1/101.29) if fc_country == "Kenya" /// June 1 2018 historical exchange rate: https://www.xe.com/currencytables/?from=KES&date=2018-06-01

			replace currency = "INR" if fc_country == "India"
			replace currencyyear_collection = 2018 if fc_country == "India" 
			replace met_xr = (1/64.456) if  fc_country == "India" /* Exchange rate INR to USD Midmarket average for 1st April 2017 to 31st March 2018, Bloomberg; the opposite met_xr is 64.456 */
			gen gdpdeflator = 135.689 / 139.64    if currency == "INR" /* Source: 2018 (latest available) vs 2019 in data.worldbank.org/indicator/NY.GDP.DEFL.ZS.AD */
			replace currencyyear_collection = 2019 if fc_name == "M201147P"
			
			replace currency = "GEL" if fc_country == "Georgia"
			replace currencyyear_collection = 2018 if fc_country == "Georgia"
			replace met_xr =  (1/2.53) if fc_country == "Georgia" /// June 1 2018 historical exchange rate: https://www.xe.com/currencytables/?from=GEL&date=2018-06-01

			replace currency = "PHP" if fc_country == "Philippines"
			replace currencyyear_collection = 2017 if fc_country == "Philippines"
			replace met_xr = (1/50.406) if fc_country == "Philippines" /* Average 2017 period exchange rate (Source: Bloomberg) IGB 1st July 20 changed from met_xr = 0.0190541781 */
			replace gdpdeflator = 	182.4131964 / 189.2735101 if currency == "PHP"
			
			replace currencyyear_collection = 2018 if fc_name == "Angeles University Foundation and Medical Center" | fc_name == "Briton-Ameer Diagnostics Lab" | fc_name == "Calumpit Drugstore and Family Clinic" | fc_name == "Camp Panacan Station Hospital" | fc_name == "De Jesus General Hospital" | fc_name == "Isaac and Catalina Medical Center" | fc_name == "Tech Med Medical Clinic and Laboratory Center" | fc_name == "El Nido" & output == "Community Screening Visit"
				
			replace currency = "ETB" if fc_country == "Ethiopia"
			replace currencyyear_collection = 2018 if fc_country == "Ethiopia"
			replace met_xr = 0.0365732000 if fc_country == "Ethiopia" /// historical mid-market exchange rate, met_xr = 0.0365732000 at January 1 2018 https://www.xe.com/currencytables/?from=ETB&date=2018-01-01
			
			gen USD_GDPpercapita = 771.5238139 if fc_country == "Ethiopia"
			replace USD_GDPpercapita = 4722.787783 if fc_country == "Georgia"
			replace USD_GDPpercapita = 2005.863005 if fc_country == "India"
			replace USD_GDPpercapita = 1707.986805 if fc_country == "Kenya"
			replace USD_GDPpercapita = 3252.092324 if fc_country == "Philippines"






			gen currencyyear_reported = currencyyear_collection
			
			
			egen totalcost = rowtotal(cost_total_bldgs cost_total_drugs cost_total_equip_med cost_total_equip_other cost_total_food cost_total_furniture cost_total_maintenance cost_total_other cost_total_staff_clin cost_total_staff_support cost_total_staff_vol cost_total_supplies_med cost_total_supplies_other cost_total_training cost_total_transport cost_total_utilities cost_total_vehicles), missing
			gen unitcost = totalcost/ servicestatistics
			drop if totalcost == . | totalcost == 0
			
			foreach var of varlist cost_direct_* cost_ohead_* cost_total_* unitcost_* p_* totalcost unitcost {
				replace `var' = `var' * gdpdeflator if currencyyear_collection == 2019 & fc_country == "India" 
							replace currencyyear_reported = 2018 if currencyyear_collection == 2019  &  fc_country == "India" 
				replace `var' = `var' * 1/gdpdeflator if currencyyear_collection == 2017 & fc_country == "Philippines" 
							replace currencyyear_reported = 2018 if currencyyear_collection == 2017 & fc_country == "Philippines" 
				gen USD_`var' = `var' * met_xr
				rename `var' LCU_`var'
				}
		

/* This section renames outputs so that all data from all countries follows the same naming standard - to allow cross-country analysis */
		
				
		gen aggregate = 1 if output == "COMMUNITY SERVICES" | output == "TB DRUGS" | output == "INPATIENT SERVICES" | output == "LABORATORY SERVICES" | output == "OTHER TB SERVICES" | output == "OUTPATIENT SERVICES" |output == "PHARMACY" | output == "RADIOLOGY" | output == "SUMMARY AGGREGATE" 
		recode aggregate . = 0
		gen ohds = 1 if output == "Admin and management " | output == "Other ohds" 
		recode ohds . = 0 /*distinguishing aggregate and ohd outputs from actual interventions*/
		keep if aggregate == 0 & ohds == 0 
		drop aggregate ohds fc_geog2 fc_geog3 servoutput
		
				replace fc_type = "Community Health Unit" if fc_type == "Community health Unit"
				replace fc_type = "Secondary hospital" if fc_type == "Secondary (county/general) hospital"
				replace fc_type = "Tertiary hospital" if fc_type == "Tertiary (national/ teaching/ referral/ specialised_ hospital"
				replace fc_type = "Tertiary hospital" if fc_type == "Tertiary (national/teaching/referral/specialised_ hospital"
				replace fc_type = "Tertiary hospital" if fc_type == "Tertiary (national/ teaching/ referral/ specialised) hospital"
				replace fc_type = "Community health unit" if fc_type == "Community Health Unit" | fc_type == "Community health unit"
				replace fc_type = "Reference Laboratory" if fc_type == "Reference laboratory"

		drop if LCU_unitcost == 0 | LCU_unitcost == .
		drop if (originaloutputdescription=="Culture - solid medium [e.g.: Lowenstein-Jensen, Ogawa or Stonebrink]" & fc_name == "M201147P")
		drop if (originaloutputdescription=="Culture - liquid media [e.g.: MB/Bact Alert, Bactec MGIT 960]" & fc_name == "M201147P")
		

		rename currencyyear_collection met_currencyyear_collection
		rename currencyyear_reported met_currencyyear_reported
		rename met_xr met_USDexchangerate
		rename gdpdeflator met_GDPdeflator
		rename currency met_currency
		rename ss_opvisits_TB fc_opvisits_TB
		rename ss_opvisits_total fc_opvisits_total
		
		order output output_pop2, after(outputgroup)

		order met_FINvECON met_TDvBU met_currency met_currencyyear_collection met_currencyyear_reported met_*, after(fc_totalstaff_FTE)
		order met_*, after(fc_totalstaff_FTE)
		order USD_* LCU_* originaloutputdescription, last

		sort fc_country fc_name
		gen fc_code = ""
			foreach c in Philippines Georgia Ethiopia India Kenya {
			encode fc_name if fc_country == "`c'", gen(facilityid)
			label drop facilityid
			gen countrycode = upper(substr(fc_country,1,2)) if fc_country == "`c'"
			egen temp = concat(countrycode facilityid)
			replace fc_code = temp if  fc_country == "`c'"
			drop facilityid temp countrycode
			}
			
		order fc_code, after(fc_country)
		 drop fc_name 
		 
		quietly {
		label var fc_country "Country"
		label var fc_geog1 "Geography (rural/urban)"
		label var fc_type "Facility level"
		label var fc_ownership "Facility ownership"
		label var fc_size_m2 "Size of facility buildings (approx m2)"
		label var fc_beds_total "Total hospital beds (inpatient)"
		label var fc_beds_TB "Total hospital beds (inpatient) TB"
		label var fc_opvisits_total "Total outpatient visits"
		label var fc_opvisits_TB "Total outpatient visits (TB)"
		label var fc_catchmentpop "Size of catchment population"
		label var fc_clinicalstaff_FTE "Total clinical staff FTE"
		label var fc_supportstaff_FTE "Total support staff FTE"
		label var fc_totalstaff_FTE "Total staff FTE"
		label var outputgroup "Output group"
		label var originaloutputdescription "Output description (original wording)"
		label var met_TDvBU "Methods: top-down vs bottom-up cost estimates"
		label var met_stafftime_obs "% observations where staff time measured by observation"
		label var met_stafftime_int "% observations where staff time measured by interview"
		label var met_stafftime_tmst "% observations where staff time measured by timesheet"
		label var met_stafftime_ass "% observations where staff time measured by assumption"
		label var met_equip_obs "% observations where equipment use measured by observation"
		label var met_equip_int "% observations where equipment use measured by interview"
		label var met_supp_obs "% observations where supply use measured by observation"
		label var met_supp_int "% observations where supply use measured by interview"
		label var met_FINvECON "Methods: financial vs economic cost estimates"
		label var LCU_cost_direct_bldgs "Direct costs (Buildings), LCU"
		label var LCU_cost_direct_equip_med "Direct costs (Laboratory and Medical equipment), LCU"
		label var LCU_cost_direct_equip_other "Direct costs (Other equipment), LCU"
		label var LCU_cost_direct_furniture "Direct costs (Furniture), LCU"
		label var LCU_cost_direct_vehicles "Direct costs (Vehicles), LCU"
		label var LCU_cost_direct_training "Direct costs (Training), LCU"
		label var LCU_cost_direct_staff_clin "Direct costs (Clinical staff), LCU"
		label var LCU_cost_direct_staff_support "Direct costs (Support staff), LCU"
		label var LCU_cost_direct_staff_vol "Direct costs (Volunteers), LCU"
		label var LCU_cost_direct_supplies_med "Direct costs (Medical supplies), LCU"
		label var LCU_cost_direct_drugs "Direct costs (Drugs), LCU"
		label var LCU_cost_direct_supplies_other "Direct costs (Other (non-medical) supplies), LCU"
		label var LCU_cost_direct_maintenance "Direct costs (Capital maintenance), LCU"
		label var LCU_cost_direct_utilities "Direct costs (Utilities), LCU"
		label var LCU_cost_direct_transport "Direct costs (Fuel and other transport recurrent (incl. maintenance & courier services)), LCU"
		label var LCU_cost_direct_food "Direct costs (Food, supplements, including food services), LCU"
		label var LCU_cost_direct_other "Direct costs (Other recurrent), LCU"
		label var LCU_cost_ohead_bldgs "Overhead costs (Buildings), LCU"
		label var LCU_cost_ohead_equip_med "Overhead costs (Laboratory and Medical equipment), LCU"
		label var LCU_cost_ohead_equip_other "Overhead costs (Other equipment), LCU"
		label var LCU_cost_ohead_furniture "Overhead costs (Furniture), LCU"
		label var LCU_cost_ohead_vehicles "Overhead costs (Vehicles), LCU"
		label var LCU_cost_ohead_training "Overhead costs (Training), LCU"
		label var LCU_cost_ohead_staff_clin "Overhead costs (Clinical staff), LCU"
		label var LCU_cost_ohead_staff_support "Overhead costs (Support staff), LCU"
		label var LCU_cost_ohead_staff_vol "Overhead costs (Volunteers), LCU"
		label var LCU_cost_ohead_supplies_med "Overhead costs (Medical supplies), LCU"
		label var LCU_cost_ohead_drugs "Overhead costs (Drugs), LCU"
		label var LCU_cost_ohead_supplies_other "Overhead costs (Other (non-medical) supplies), LCU"
		label var LCU_cost_ohead_maintenance "Overhead costs (Capital maintenance), LCU"
		label var LCU_cost_ohead_utilities "Overhead costs (Utilities), LCU"
		label var LCU_cost_ohead_transport "Overhead costs (Fuel and other transport recurrent (incl. maintenance & courier services)), LCU"
		label var LCU_cost_ohead_food "Overhead costs (Food, supplements, including food services), LCU"
		label var LCU_cost_ohead_other "Overhead costs (Other recurrent), LCU"
		label var LCU_cost_total_bldgs "Total costs (Buildings), LCU"
		label var LCU_cost_total_equip_med "Total costs (Laboratory and Medical equipment), LCU"
		label var LCU_cost_total_equip_other "Total costs (Other equipment), LCU"
		label var LCU_cost_total_furniture "Total costs (Furniture), LCU"
		label var LCU_cost_total_vehicles "Total costs (Vehicles), LCU"
		label var LCU_cost_total_training "Total costs (Training), LCU"
		label var LCU_cost_total_staff_clin "Total costs (Clinical staff), LCU"
		label var LCU_cost_total_staff_support "Total costs (Support staff), LCU"
		label var LCU_cost_total_staff_vol "Total costs (Volunteers), LCU"
		label var LCU_cost_total_supplies_med "Total costs (Medical supplies), LCU"
		label var LCU_cost_total_drugs "Total costs (Drugs), LCU"
		label var LCU_cost_total_supplies_other "Total costs (Other (non-medical) supplies), LCU"
		label var LCU_cost_total_maintenance "Total costs (Capital maintenance), LCU"
		label var LCU_cost_total_utilities "Total costs (Utilities), LCU"
		label var LCU_cost_total_transport "Total costs (Fuel and other transport recurrent (incl. maintenance & courier services)), LCU"
		label var LCU_cost_total_food "Total costs (Food, supplements, including food services), LCU"
		label var LCU_cost_total_other "Total costs (Other recurrent), LCU"
		label var servicestatistics "Service statistics (outputs per year)"
		label var LCU_unitcost_bldgs "Unit costs (Buildings), LCU"
		label var LCU_unitcost_equip_med "Unit costs (Laboratory and Medical equipment), LCU"
		label var LCU_unitcost_equip_other "Unit costs (Other equipment), LCU"
		label var LCU_unitcost_furniture "Unit costs (Furniture), LCU"
		label var LCU_unitcost_vehicles "Unit costs (Vehicles), LCU"
		label var LCU_unitcost_training "Unit costs (Training), LCU"
		label var LCU_unitcost_staff_clin "Unit costs (Clinical staff), LCU"
		label var LCU_unitcost_staff_support "Unit costs (Support staff), LCU"
		label var LCU_unitcost_staff_vol "Unit costs (Volunteers), LCU"
		label var LCU_unitcost_supplies_med "Unit costs (Medical supplies), LCU"
		label var LCU_unitcost_drugs "Unit costs (Drugs), LCU"
		label var LCU_unitcost_supplies_other "Unit costs (Other (non-medical) supplies), LCU"
		label var LCU_unitcost_maintenance "Unit costs (Capital maintenance), LCU"
		label var LCU_unitcost_utilities "Unit costs (Utilities), LCU"
		label var LCU_unitcost_transport "Unit costs (Fuel and other transport recurrent (incl. maintenance & courier services)), LCU"
		label var LCU_unitcost_food "Unit costs (Food, supplements, including food services), LCU"
		label var LCU_unitcost_other "Unit costs (Other recurrent), LCU"
		label var LCU_unitcost_total "Unit costs (TOTAL), LCU"
		label var q_bldgspace "Building space per output (m2)"
		label var q_stafftime_clin "Clinical staff time per output (minutes)"
		label var q_stafftime_support "Support staff time per output (minutes)"
		label var q_stafftime_vol "Volunteer staff time per output (minutes)"
		label var LCU_p_bldgspace "Mean price, building space (local currency per m2)"
		label var LCU_p_stafftime_clin "Mean price, clinical staff time (local currency per minute)"
		label var LCU_p_stafftime_support "Mean price, support staff time (local currency per minute)"
		label var LCU_p_stafftime_vol "Mean price, volunteer staff time (local currency per minute)"
		label var output "Output"
		label var output_pop2 "Further output detail"
		label var fc_code "Facility code"
		label var met_currency "Currency"
		label var met_currencyyear_collection "Currency year of data collection"
		label var met_currencyyear_reported "Currency year that data is reported in"
		label var met_USDexchangerate "Exchange rate (LCU to USD)"
		label var met_GDPdeflator "GDP deflator adjusting currency year from collection to reported"
		label var USD_cost_direct_bldgs "Direct costs (Buildings), USD"
		label var USD_cost_direct_equip_med "Direct costs (Laboratory and Medical equipment), USD"
		label var USD_cost_direct_equip_other "Direct costs (Other equipment), USD"
		label var USD_cost_direct_furniture "Direct costs (Furniture), USD"
		label var USD_cost_direct_vehicles "Direct costs (Vehicles), USD"
		label var USD_cost_direct_training "Direct costs (Training), USD"
		label var USD_cost_direct_staff_clin "Direct costs (Clinical staff), USD"
		label var USD_cost_direct_staff_support "Direct costs (Support staff), USD"
		label var USD_cost_direct_staff_vol "Direct costs (Volunteers), USD"
		label var USD_cost_direct_supplies_med "Direct costs (Medical supplies), USD"
		label var USD_cost_direct_drugs "Direct costs (Drugs), USD"
		label var USD_cost_direct_supplies_other "Direct costs (Other (non-medical) supplies), USD"
		label var USD_cost_direct_maintenance "Direct costs (Capital maintenance), USD"
		label var USD_cost_direct_utilities "Direct costs (Utilities), USD"
		label var USD_cost_direct_transport "Direct costs (Fuel and other transport recurrent (incl. maintenance & courier services)), USD"
		label var USD_cost_direct_food "Direct costs (Food, supplements, including food services), USD"
		label var USD_cost_direct_other "Direct costs (Other recurrent), USD"
		label var USD_cost_ohead_bldgs "Overhead costs (Buildings), USD"
		label var USD_cost_ohead_equip_med "Overhead costs (Laboratory and Medical equipment), USD"
		label var USD_cost_ohead_equip_other "Overhead costs (Other equipment), USD"
		label var USD_cost_ohead_furniture "Overhead costs (Furniture), USD"
		label var USD_cost_ohead_vehicles "Overhead costs (Vehicles), USD"
		label var USD_cost_ohead_training "Overhead costs (Training), USD"
		label var USD_cost_ohead_staff_clin "Overhead costs (Clinical staff), USD"
		label var USD_cost_ohead_staff_support "Overhead costs (Support staff), USD"
		label var USD_cost_ohead_staff_vol "Overhead costs (Volunteers), USD"
		label var USD_cost_ohead_supplies_med "Overhead costs (Medical supplies), USD"
		label var USD_cost_ohead_drugs "Overhead costs (Drugs), USD"
		label var USD_cost_ohead_supplies_other "Overhead costs (Other (non-medical) supplies), USD"
		label var USD_cost_ohead_maintenance "Overhead costs (Capital maintenance), USD"
		label var USD_cost_ohead_utilities "Overhead costs (Utilities), USD"
		label var USD_cost_ohead_transport "Overhead costs (Fuel and other transport recurrent (incl. maintenance & courier services)), USD"
		label var USD_cost_ohead_food "Overhead costs (Food, supplements, including food services), USD"
		label var USD_cost_ohead_other "Overhead costs (Other recurrent), USD"
		label var USD_cost_total_bldgs "Total costs (Buildings), USD"
		label var USD_cost_total_equip_med "Total costs (Laboratory and Medical equipment), USD"
		label var USD_cost_total_equip_other "Total costs (Other equipment), USD"
		label var USD_cost_total_furniture "Total costs (Furniture), USD"
		label var USD_cost_total_vehicles "Total costs (Vehicles), USD"
		label var USD_cost_total_training "Total costs (Training), USD"
		label var USD_cost_total_staff_clin "Total costs (Clinical staff), USD"
		label var USD_cost_total_staff_support "Total costs (Support staff), USD"
		label var USD_cost_total_staff_vol "Total costs (Volunteers), USD"
		label var USD_cost_total_supplies_med "Total costs (Medical supplies), USD"
		label var USD_cost_total_drugs "Total costs (Drugs), USD"
		label var USD_cost_total_supplies_other "Total costs (Other (non-medical) supplies), USD"
		label var USD_cost_total_maintenance "Total costs (Capital maintenance), USD"
		label var USD_cost_total_utilities "Total costs (Utilities), USD"
		label var USD_cost_total_transport "Total costs (Fuel and other transport recurrent (incl. maintenance & courier services)), USD"
		label var USD_cost_total_food "Total costs (Food, supplements, including food services), USD"
		label var USD_cost_total_other "Total costs (Other recurrent), USD"
		label var USD_unitcost_bldgs "Unit costs (Buildings), USD"
		label var USD_unitcost_equip_med "Unit costs (Laboratory and Medical equipment), USD"
		label var USD_unitcost_equip_other "Unit costs (Other equipment), USD"
		label var USD_unitcost_furniture "Unit costs (Furniture), USD"
		label var USD_unitcost_vehicles "Unit costs (Vehicles), USD"
		label var USD_unitcost_training "Unit costs (Training), USD"
		label var USD_unitcost_staff_clin "Unit costs (Clinical staff), USD"
		label var USD_unitcost_staff_support "Unit costs (Support staff), USD"
		label var USD_unitcost_staff_vol "Unit costs (Volunteers), USD"
		label var USD_unitcost_supplies_med "Unit costs (Medical supplies), USD"
		label var USD_unitcost_drugs "Unit costs (Drugs), USD"
		label var USD_unitcost_supplies_other "Unit costs (Other (non-medical) supplies), USD"
		label var USD_unitcost_maintenance "Unit costs (Capital maintenance), USD"
		label var USD_unitcost_utilities "Unit costs (Utilities), USD"
		label var USD_unitcost_transport "Unit costs (Fuel and other transport recurrent (incl. maintenance & courier services)), USD"
		label var USD_unitcost_food "Unit costs (Food, supplements, including food services), USD"
		label var USD_unitcost_other "Unit costs (Other recurrent), USD"
		label var USD_unitcost_total "Unit costs (TOTAL), USD"
		label var USD_p_bldgspace "Mean price, building space (USD per m2)"
		label var USD_p_stafftime_clin "Mean price, clinical staff time (USD per minute)"
		label var USD_p_stafftime_support "Mean price, support staff time (USD per minute)"
		label var USD_p_stafftime_vol "Mean price, volunteer staff time (USD per minute)"
		label var USD_totalcost "Total cost, USD"
		label var USD_unitcost "Unit cost, USD"
		label var LCU_totalcost "Total cost, LCU"
		label var LCU_unitcost "Unit cost, LCU"
		}

		


		
		
/* Finally we save this dataset as 'Outputs' */
		save "Analysis/`date_string'/pooled dataset_outputs.dta", replace	
	*	export excel using "Analysis/`date_string'/data export_`date_string'.xlsx", sheet("outputs") sheetreplace firstrow(variables) 



*************************************************************************************
*************************************************************************************
*******   Compiling and cleaning the pooled dataset - OUTPUT COSTS BY INPUT   *******
*************************************************************************************
*************************************************************************************


/* We transform the output dataset to a long format here, to facilitate some analysis and make generation of graphs etc easier */

		use "Analysis/`date_string'/pooled dataset_outputs.dta", clear	
		
		quietly {

		egen USD_inputs_tc_staff = rowtotal(USD_cost_direct_staff_clin USD_cost_direct_staff_support USD_cost_direct_staff_vol), missing

		egen USD_inputs_tc_capital = rowtotal(USD_cost_direct_bldgs USD_cost_direct_equip_med USD_cost_direct_equip_other USD_cost_direct_furniture USD_cost_direct_training USD_cost_direct_vehicles), missing

		egen USD_inputs_tc_consumables = rowtotal( USD_cost_direct_supplies_med USD_cost_direct_drugs USD_cost_direct_supplies_other USD_cost_direct_maintenance USD_cost_direct_utilities USD_cost_direct_transport USD_cost_direct_food USD_cost_direct_other), missing

		egen USD_inputs_tc_ohd = rowtotal(USD_cost_ohead_bldgs USD_cost_ohead_equip_med USD_cost_ohead_equip_other USD_cost_ohead_furniture USD_cost_ohead_vehicles USD_cost_ohead_training USD_cost_ohead_staff_clin USD_cost_ohead_staff_support USD_cost_ohead_staff_vol USD_cost_ohead_supplies_med USD_cost_ohead_drugs USD_cost_ohead_supplies_other USD_cost_ohead_maintenance USD_cost_ohead_utilities USD_cost_ohead_transport USD_cost_ohead_food USD_cost_ohead_other), missing

		egen USD_inputs_tc_total = rowtotal(USD_inputs_tc_staff USD_inputs_tc_capital USD_inputs_tc_consumables USD_inputs_tc_ohd), missing


        gen USD_inputs_uc_staff = USD_inputs_tc_staff / servicestatistics
        gen USD_inputs_uc_capital = USD_inputs_tc_capital / servicestatistics
        gen USD_inputs_uc_consumables = USD_inputs_tc_consumables / servicestatistics
        gen USD_inputs_uc_ohd = USD_inputs_tc_ohd / servicestatistics			  
		gen USD_inputs_uc_total = USD_totalcost / servicestatistics

		egen LCU_inputs_tc_staff = rowtotal(LCU_cost_direct_staff_clin LCU_cost_direct_staff_support LCU_cost_direct_staff_vol), missing

		egen LCU_inputs_tc_capital = rowtotal(LCU_cost_direct_bldgs LCU_cost_direct_equip_med LCU_cost_direct_equip_other LCU_cost_direct_furniture LCU_cost_direct_training LCU_cost_direct_vehicles), missing

		egen LCU_inputs_tc_consumables = rowtotal( LCU_cost_direct_supplies_med LCU_cost_direct_drugs LCU_cost_direct_supplies_other LCU_cost_direct_maintenance LCU_cost_direct_utilities LCU_cost_direct_transport LCU_cost_direct_food LCU_cost_direct_other), missing

		egen LCU_inputs_tc_ohd = rowtotal(LCU_cost_ohead_bldgs LCU_cost_ohead_equip_med LCU_cost_ohead_equip_other LCU_cost_ohead_furniture LCU_cost_ohead_vehicles LCU_cost_ohead_training LCU_cost_ohead_staff_clin LCU_cost_ohead_staff_support LCU_cost_ohead_staff_vol LCU_cost_ohead_supplies_med LCU_cost_ohead_drugs LCU_cost_ohead_supplies_other LCU_cost_ohead_maintenance LCU_cost_ohead_utilities LCU_cost_ohead_transport LCU_cost_ohead_food LCU_cost_ohead_other), missing

		egen LCU_inputs_tc_total = rowtotal(LCU_inputs_tc_staff LCU_inputs_tc_capital LCU_inputs_tc_consumables LCU_inputs_tc_ohd), missing

                                                     
       gen LCU_inputs_uc_staff = LCU_inputs_tc_staff / servicestatistics
       gen LCU_inputs_uc_capital = LCU_inputs_tc_capital / servicestatistics
       gen LCU_inputs_uc_consumables = LCU_inputs_tc_consumables / servicestatistics
       gen LCU_inputs_uc_ohd = LCU_inputs_tc_ohd / servicestatistics
		gen LCU_inputs_uc_total = LCU_totalcost / servicestatistics
	
		}


				
		egen reshapeid = group(fc_code output outputgroup output_pop2 met_TDvBU met_FINvECON ), missing
		
		drop if output == "0"
	
		drop USD_cost_* LCU_cost_* USD_unitcost_* LCU_unitcost_* 

		reshape long USD_inputs_uc_ USD_inputs_tc_  LCU_inputs_uc_ LCU_inputs_tc_ ///
		 , i(reshapeid) j(costtype) string
		 
 
		save "Analysis/`date_string'/pooled dataset_outputs_long_summary.dta", replace
		export excel using "Analysis/`date_string'/data export_`date_string'.xlsx", sheet("outputs_long_summary") sheetreplace firstrow(variables) 

*/

*****************************************************************************
*****************************************************************************
*******   Compiling and cleaning the pooled dataset - PATIENT COSTS   *******
*****************************************************************************
*****************************************************************************

clear


/*The following nested loops import data from Excel files, clean up variable naming and labelling, and pool all datasets together
Before running this Do File, place all completed Excel sheets into the following folder: Complete data for pooling/Excel Files/... 
Make sure there are no spaces in file names - follow naming convention in list below*/

foreach cdirs in  Philippines Georgia Ethiopia India Kenya    {  /* Georgia India Kenya Ethiopia Philippines  */

		local files: dir "`dir_`cdirs'_new'" files "*.xlsx", respectcase nofail  //this is the list of Excel files in the above folder
		local new: subinstr local files ".xlsx" "", all   //scrubs the extension so that we can use it below

foreach dataset in `new' {
	
	preserve
	***IMPORTING AND RENAMING VARIABLES
		di "`dataset'"
		
	 quietly {	
		/* importing file */ import excel "`dir_`cdirs'_new'/`dataset'.xlsx", sheet("Dataset patient") cellrange(A4:IF328) firstrow clear		
	local country = proper(fc_country)
	local fc_name = fc_name
	
				foreach var in fc_clinicalstaff_FTE fc_supportstaff_FTE fc_totalstaff_FTE {
							cap confirm string variable `var'
							if !_rc {
								replace `var' = "." if `var' == "no data" | `var' == "n/a" 
							destring `var', replace force
			}
			}

	save "Analysis/`date_string'/facilityfiles/`country'_`fc_name'_patient.dta", replace /* saving imported data as a Stata file */  												
					
	/* This section renames outputs so that all data from all countries follows the same naming standard - to allow cross-country analysis */
	
	
		replace int_type = "TB prevention" if int_class == "TB PREVENTION"
									
				foreach var of varlist q_* {
					cap destring `var', replace force
					local newname = subinstr("`var'","Additionaltesttype", "addtst_",1)   
					local newname = subinstr("`newname'","Additionalradtesttype", "addrad_",1)   
					local newname = subinword("`newname'","Outpatient", "OP",1)   
					local newname = subinword("`newname'","outpatient", "OP",1)  
					local newname = subinword("`newname'","Outtpatient", "OP",1)  
					local newname = subinword("`newname'","Inpatient", "IP",1)   
					local newname = subinword("`newname'","Community", "CM",1)   
					local newname = subinstr("`newname'","Other", "other",1)   
					local newname = subinword("`newname'","Lost to followup", "LTFU",1)   
					local newname = subinstr("`newname'","e.g.", "",.)   
					local newname = subinword("`newname'","during", "_",1)   
					local newname = subinstr("`newname'","Visitfor","",1)
					local newname = subinstr("`newname'","visitfor","",1)
					local newname = subinstr("`newname'","for","_",1)
					local newname = subinstr("`newname'","medicine","meds",1)
					local newname = subinstr("`newname'","Losttofollowup","LTFU",1)
					local newname = subinstr("`newname'","Patient support","Support",1)
					local newname = subinstr("`newname'"," and ","&",1)
					local newname = subinstr("`newname'","_ ", "_",.)   
					local newname = subinstr("`newname'"," _", "_",.)   
					local newname = subinstr("`newname'","  ", " ",.)   
					local newname = substr("`newname'",1,30)
					local newname = substr("`newname'",1,25)
					quietly rename `var' `newname'
						} 
	
				foreach var of varlist uc_* tc_* {
					quietly destring `var', replace force
					local newname = subinstr("`var'","Additionaltesttype", "addtst_",1)   
					local newname = subinstr("`newname'","Additionalradtesttype", "addrad_",1)   
					local newname = substr("`newname'",1,30)
					local newname = subinword("`newname'","Outpatient", "OP",1)   
					local newname = subinword("`newname'","outpatient", "OP",1)  
					local newname = subinword("`newname'","Outtpatient", "OP",1)  
					local newname = subinword("`newname'","Inpatient", "IP",1)   
					local newname = subinword("`newname'","Community", "CM",1)   
					local newname = subinstr("`newname'","Other", "other",1) 
					local newname = subinword("`newname'","Lost to followup", "LTFU",1)   
					local newname = subinstr("`newname'","e.g.", "",.)   
					local newname = subinword("`newname'","during", "_",1)   
					local newname = subinstr("`newname'","Visitfor","",1)
					local newname = subinstr("`newname'","visitfor","",1)
					local newname = subinstr("`newname'","for","_",1)
					local newname = subinstr("`newname'","medicine","meds",1)
					local newname = subinstr("`newname'","Losttofollowup","LTFU",1)
					local newname = subinstr("`newname'","Patient support","Support",1)
					local newname = subinstr("`newname'"," and ","&",1)
					local newname = subinstr("`newname'","_ ", "_",.)   
					local newname = subinstr("`newname'"," _", "_",.)   
					local newname = subinstr("`newname'","  ", " ",.)   
					local newname = substr("`newname'",1,26)
					quietly rename `var' `newname'
					}

			
						
				foreach var in q uc tc {															
					cap rename	`var'_ip_bedday_DSTB	`var'_ip_bedday_DS
					cap rename	`var'_ip_beddayDSTB	`var'_ip_bedday_DS
					cap rename	`var'_ip_DRTBinpatientbedday	`var'_ip_bedday_MDR
					cap rename	`var'_ip_DRTBinpatientbedday	`var'_ip_beddaytype2
					cap rename	`var'_ip_DSTBinpatientbedday	`var'_ip_bedday_DS
					cap rename	`var'_ip_DSTBinpatientbedday	`var'_ip_beddaytype1
					cap rename	`var'_lab_Albumin	`var'_lab_albumin
					cap rename	`var'_lab_Alkalinephosphatase	`var'_lab_alkalinephosphatase
					cap rename	`var'_lab_ALTSGPT	`var'_lab_ALTorSGPT
					cap rename	`var'_lab_aspirates	`var'_lab_aspiratesEPTB
					cap rename	`var'_lab_ASTSGOT	`var'_lab_ASTorSGOT
					cap rename	`var'_lab_Audiometry	`var'_lab_audiometry
					cap rename	`var'_lab_Audiometrytest	`var'_lab_audiometry
					cap rename	`var'_lab_Bilirubin	`var'_lab_bilirubin
					cap rename	`var'_lab_BiochemistryALTASTB	`var'_lab_biochemistry
					cap rename	`var'_lab_Bloodclotting	`var'_lab_bloodclotting
					cap rename	`var'_lab_BloodgroupRH	`var'_lab_bloodgroupRH
					cap rename	`var'_lab_BloodSugarTest	`var'_lab_bloodsugar
					cap rename	`var'_lab_Bloodureanitrogen	`var'_lab_bloodureanitrogen
					cap rename	`var'_lab_BloodUreaNitrogen	`var'_lab_bloodureanitrogen
					cap rename	`var'_lab_BodyFluids	`var'_lab_bodyfluidanalysis
					cap rename	`var'_lab_BrainHeartInfusionB	`var'_lab_BHIagar
					cap rename	`var'_lab_Cerebrospinalfluid	`var'_lab_cerebrospinalfluid
					cap rename	`var'_lab_Citology	`var'_lab_citology
					cap rename	`var'_lab_Clinicalchemistry	`var'_lab_LFT_UEC
					cap rename  `var'_lab_CXRfilm `var'_rad_CXRfilm
					cap rename  `var'_lab_CXRdigital `var'_rad_CXRdigital
					cap rename	`var'_lab_Discodantdiscripant	`var'_lab_DBS
					cap rename	`var'_lab_DST_FLliquid	`var'_lab_DST_FL_liquid
					cap rename	`var'_lab_DST_FLsolic	`var'_lab_DST_FL_solid
					cap rename	`var'_lab_DST_SLliquid	`var'_lab_DST_SL_liquid
					cap rename	`var'_lab_DST_SLsolid	`var'_lab_DST_SL_solid
					cap rename	`var'_lab_Electrolites	`var'_lab_electrolytetest
					cap rename	`var'_lab_Electrolytes	`var'_lab_electrolytetest
					cap rename	`var'_lab_Electrolytespanelte	`var'_lab_electrolytetest
					cap rename	`var'_lab_FastingBloodSugar	`var'_lab_fastingbloodsugar
					cap rename	`var'_lab_fullhemogram	`var'_lab_fullhaemogram
					cap rename	`var'_lab_GeneXpertsentout	`var'_lab_collectsputum_Xpert
					cap rename	`var'_lab_Haematological	`var'_lab_haematological
					cap rename	`var'_lab_HEPCTest	`var'_lab_HEPCtest
					cap rename	`var'_lab_HIVconftest	`var'_lab_HIVconfirmatorytest
					cap rename	`var'_lab_Immunology	`var'_lab_immunology
					cap rename	`var'_lab_liquidculture	`var'_lab_sputumculture
					cap rename	`var'_lab_LiverFunctionTestsL	`var'_lab_liverfunctiontest
					cap rename	`var'_lab_LPAdirect1st2ndline	`var'_lab_LPA
					cap rename	`var'_lab_LPAFLD	`var'_lab_LPA_FLD
					cap rename	`var'_lab_LPASLD	`var'_lab_LPA_SLD
					cap rename	`var'_lab_Magnesium	`var'_lab_magnesium
					cap rename	`var'_lab_Pleuraltapping	`var'_lab_pleuraltapping
					cap rename	`var'_lab_Potassium	`var'_lab_potassium
					cap rename	`var'_lab_Pregnancy	`var'_lab_pregnancytest
					cap rename	`var'_lab_PregnancyTest	`var'_lab_pregnancytest
					cap rename	`var'_lab_RBS	`var'_lab_bloodsugar
					cap rename	`var'_lab_RenalFunctionTestsR	`var'_lab_renalfunctiontest
					cap rename	`var'_lab_Serology	`var'_lab_serology
					cap rename	`var'_lab_SerumUricAcid	`var'_lab_serumuricacid
					cap rename	`var'_lab_smearinduction	`var'_lab_collectsputum
					cap rename	`var'_lab_smearmicroscopy	`var'_lab_smearmicroscopyzn
					cap rename	`var'_lab_Smearpreparation	`var'_lab_smearpreparation
					cap rename	`var'_lab_SmearZNsentout	`var'_lab_collectsputum_smearZN
					cap rename	`var'_lab_solidculture	`var'_lab_sputumculture
					cap rename	`var'_lab_Sputum_Xpertreferra	`var'_lab_collectsputum_Xpert
					cap rename	`var'_lab_SputumCollection	`var'_lab_collectsputum
					cap rename	`var'_lab_Sputumcollection	`var'_lab_collectsputum
					cap rename	`var'_lab_SputumCollection_Cu	`var'_lab_collectsputum_culture
					cap rename	`var'_lab_SputumCollection_DS	`var'_lab_collectsputum_DST
					cap rename	`var'_lab_SputumCollection_LP	`var'_lab_collectsputum_LPA
					cap rename	`var'_lab_SrProtein	`var'_lab_protein
					cap rename	`var'_lab_TBCulture	`var'_lab_sputumculture
					cap rename	`var'_lab_TBPCRAdult	`var'_lab_TBPCRadult
					cap rename	`var'_lab_totalProtein	`var'_lab_protein
					cap rename	`var'_lab_Transportofblood	`var'_lab_transportofblood
					cap rename	`var'_lab_TSTPPD	`var'_lab_TSTPPDtest
					cap rename	`var'_lab_Uricacid	`var'_lab_uricacid
					cap rename	`var'_lab_Urinalysis	`var'_lab_urinalysis
					cap rename	`var'_lab_Urineanalysis	`var'_lab_urinalysis
					cap rename	`var'_lab_ViralLoad	`var'_lab_viralload
					cap rename	`var'_lab_Viralload	`var'_lab_viralload
					cap rename	`var'_lab_VisualAcuity	`var'_lab_visualacuity
					cap rename	`var'_lab_WBC	`var'_lab_totalWBC
					cap rename	`var'_lab_xray	`var'_lab_xrayallotherbody
					cap rename	`var'_op_adherencesupport	`var'_op_adherencesupportvisit
					cap rename	`var'_op_adherencesupportvisi	`var'_op_adherencesupportvisit
					cap rename  `var'_op_Adherencesupportvisi `var'_op_adherencesupportvisit
					cap rename	`var'_op_collectingmedici	`var'_op_collectingmeds
					cap rename	`var'_op_collectingmedss	`var'_op_collectingmeds
					cap rename	`var'_op_DOTvisitbyMDRpatient	`var'_op_MDRDOT
					cap rename	`var'_op_injection	`var'_op_injectionvisit
					cap rename	`var'_op_injection	`var'_op_injectionvisit
					cap rename	`var'_op_Phoneconsultation	`var'_op_phoneconsultation
					cap rename	`var'_op_posttreatmentfollowu	`var'_op_followupvisit
					cap rename	`var'_op_treatment	`var'_op_treatmentvisit
					cap rename	`var'_op_treatmentvisit_DOT	`var'_op_DOTvisit
					cap rename	`var'_op_visittype3	`var'_op_childTBprev
					cap rename	`var'_op_Vist_Injection	`var'_op_injectionvisit
					cap rename	`var'_oth_Contacttracing	`var'_oth_contacttracing
					cap rename	`var'_oth_Contacttracing_phon	`var'_oth_contacttracing
					cap rename	`var'_oth_diagsupport	`var'_oth_diagnosticsupport
					cap rename	`var'_oth_LTFUtracing_h	`var'_oth_LTFUtracing_homevisit
					cap rename	`var'_oth_LTFUtracing_hom	`var'_oth_LTFUtracing_homevisit
					cap rename	`var'_oth_LTFUtracing_homevis	`var'_oth_LTFUtracing_homevisit
					cap rename	`var'_oth_Phoneconsultation_D	`var'_oth_phoneconsultation
					cap rename	`var'_oth_treatsupport	`var'_op_treatmentsupport
					cap rename	`var'_rad_cardioultrasound	`var'_rad_ultrasound
					cap rename	`var'_rad_Filmprocessing_Xray	`var'_rad_filmprocessing_Xray
					cap rename	`var'_rad_Ultrasound	`var'_rad_ultrasound
					cap rename	`var'_rad_UltrasoundEPTB	`var'_rad_ultrasound
									}


				cap drop q_lab_addtst_* tc_lab_addtst_* uc_lab_addtst_*
				cap drop q_rad_addrad_* tc_rad_addrad_* uc_rad_addrad_*
				cap drop q_op_visittype* uc_op_visittype* tc_op_visittype* 
				cap drop q_ip_beddaytype* uc_ip_beddaytype* tc_ip_beddaytype*
				cap drop q_oth_otherservicetype* uc_oth_otherservicetype* tc_oth_otherservicetype*

	
		save "Analysis/`date_string'/facilityfiles/`country'_`fc_name'_patient.dta", replace	
				
				restore
				append using "Analysis/`date_string'/facilityfiles/`country'_`fc_name'_patient.dta", force
				sa "Analysis/`date_string'/pooled dataset_patient.dta", replace  
				}
				}
}		

		replace fc_country = proper(fc_country)
		sort fc_country fc_name
		gen fc_code = ""
			foreach c in Philippines Georgia Ethiopia India Kenya {
			encode fc_name if fc_country == "`c'", gen(facilityid)
			label drop facilityid
			gen countrycode = upper(substr(fc_country,1,2)) if fc_country == "`c'"
			egen temp = concat(countrycode facilityid)
			replace fc_code = temp if  fc_country == "`c'"
			drop facilityid temp countrycode
			}
			
		order fc_code, after(fc_country)

/* This section generates USD equivalents for costs.  
The exchange rates used are historical exchange rates from June 1 of the data colelction year.
Please replace as necessary is a different exchange rate is more appropriate */		

		*quietly {
		gen currency = "KES" if fc_country == "Kenya"
		gen currencyyear_collection = 2018 if fc_country == "Kenya"
		gen met_xr = (1/101.29) if currency == "KES" /// June 1 2018 historical exchange rate: https://www.xe.com/currencytables/?from=KES&date=2018-06-01

			replace currency = "INR" if fc_country == "India"
			replace currencyyear_collection = 2018 if fc_country == "India" 
			replace met_xr = (1/64.456) if currency == "INR" /* Exchange rate INR to USD Midmarket average for 1st April 2017 to 31st March 2018, Bloomberg; the opposite met_xr is 64.456 */
			gen gdpdeflator = 135.689 / 139.64   if currency == "INR" /* Source: 2018 (latest available) vs 2019 in data.worldbank.org/indicator/NY.GDP.DEFL.ZS.AD */
			replace currencyyear_collection = 2019 if fc_name == "M201147P"
			
		replace currency = "GEL" if fc_country == "Georgia"
		replace currencyyear_collection = 2018 if fc_country == "Georgia"
		replace met_xr =  (1/2.53) if currency == "GEL" /// June 1 2018 historical exchange rate: https://www.xe.com/currencytables/?from=GEL&date=2018-06-01

			replace currency = "PHP" if fc_country == "Philippines"
			replace currencyyear_collection = 2017 if fc_country == "Philippines"
			replace met_xr = (1/50.406) if currency == "PHP"  /* Average 2017 period exchange rate (Source: Bloomberg) IGB 1st July 20 changed from met_xr = 0.0190541781 */
			replace gdpdeflator = 	182.4131964 / 189.2735101 if currency == "PHP" /// June 1 2018 historical exchange rate: https://www.xe.com/currencytables/?from=PHP&date=2018-06-01

		replace currency = "ETB" if fc_country == "Ethiopia"
		replace currencyyear_collection = 2018 if fc_country == "Ethiopia"
			replace met_xr = 0.0365732000 if currency == "ETB" /// historical mid-market exchange rate, met_xr = 0.0365732000 at January 1 2018 https://www.xe.com/currencytables/?from=ETB&date=2018-01-01

			gen currencyyear_reported = currencyyear_collection
			
		foreach var of varlist uc_* tc_* {
		replace `var' = `var' * gdpdeflator if currencyyear_collection == 2019 & fc_country == "India" 
					replace currencyyear_reported = 2018 if currencyyear_collection == 2019 & fc_country == "India" 
		replace `var' = `var' * 1/gdpdeflator if currencyyear_collection == 2018 & fc_country == "Philippines" 
					replace currencyyear_reported = 2018 if currencyyear_collection == 2017 & fc_country == "Philippines" 
		gen USD_`var' = `var' * met_xr
		rename `var' LCU_`var'
	}
	
				gen USD_GDPpercapita = 771.5238139 if fc_country == "Ethiopia"
			replace USD_GDPpercapita = 4722.787783 if fc_country == "Georgia"
			replace USD_GDPpercapita = 2005.863005 if fc_country == "India"
			replace USD_GDPpercapita = 1707.986805 if fc_country == "Kenya"
			replace USD_GDPpercapita = 3252.092324 if fc_country == "Philippines"

			
		order q_op_* q_ip_* q_com_* q_oth_* q_lab_* q_rad_* ///
		LCU_uc_op_* LCU_uc_ip_* LCU_uc_com_* LCU_uc_oth_* LCU_uc_lab_* LCU_uc_rad_* ///
		LCU_tc_op_* LCU_tc_ip_* LCU_tc_com_* LCU_tc_oth_* LCU_tc_lab_* LCU_tc_rad_* LCU_tc_drugs ///
		USD_uc_op_* USD_uc_ip_* USD_uc_com_* USD_uc_oth_* USD_uc_lab_* USD_uc_rad_* ///
		USD_tc_op_* USD_tc_ip_* USD_tc_com_* USD_tc_oth_* USD_tc_lab_* USD_tc_rad_* USD_tc_drugs ///
		 , after(met_FINvECON)		

		
		egen tcost_LCU = rowtotal(LCU_tc_*)
		drop if tcost_LCU == 0 | missing(tcost_LCU)
		 
		egen tcost_USD = rowtotal(USD_tc_*)
		drop if tcost_USD == 0 | missing(tcost_USD)
		
										
		egen int_detail = concat(int_pop1 int_pop2 int_pop3 int_regimen), punct(_)
           replace int_detail = subinstr(int_detail," and ","&",1)
           replace int_detail = subinstr(int_detail,", household contact of DS-TB"," contact",1)
           replace int_detail = subinstr(int_detail,"__","_",.)
           replace int_detail = subinstr(int_detail,"__","_",.)
           replace int_detail = subinstr(int_detail,"__","_",.)
           encode int_detail, gen(int_detail_coded)
		   
		egen totalcost_opvisits = rowtotal(USD_tc_op_*)  
		egen totalcost_ipvisits = rowtotal(USD_tc_ip_*)
		egen totalcost_cmvisits = rowtotal(USD_tc_com_*)
		egen totalcost_othervisits = rowtotal(USD_tc_oth_*)
		egen totalcost_labtests = rowtotal(USD_tc_lab_*	)
		egen totalcost_radiology = rowtotal(USD_tc_rad_*)
		
		egen totalq_opvisits = rowtotal(q_op_*)  
		egen totalq_ipvisits = rowtotal(q_ip_*)
		egen totalq_cmvisits = rowtotal(q_com_*)
		egen totalq_othervisits = rowtotal(q_oth_*)
		egen totalq_labtests = rowtotal(q_lab_*	)
		egen totalq_radiology = rowtotal(q_rad_*)
		
		
	gen int_phase2 = "inpatient" if int_phase == "Intensive - inpatient"
	replace int_phase2 = "outpatient" if int_phase == "Intensive - outpatient" | int_phase == "Continuation - outpatient"
	replace int_phase = "Continuation" if int_phase == "Continuation - outpatient"
	replace int_phase = "Intensive" if int_phase == "Intensive - inpatient" | int_phase == "Intensive - inpatient" | int_phase == "Intensive - outpatient" 
	
		rename currencyyear_collection met_currencyyear_collection
		rename currencyyear_reported met_currencyyear_reported
		rename met_xr met_USDexchangerate
		rename gdpdeflator met_GDPdeflator
		rename currency met_currency
		rename ss_opvisits_TB fc_opvisits_TB
		rename ss_opvisits_total fc_opvisits_total

	
	
		//Drop facilities where interventions were partial 
		drop if fc_name == "Angeles University Foundation Medical Center" & int_type == "1st Line TB Treatment"
		drop if fc_name == "Isaac and Catalina Medical Center" & int_type == "1st Line TB Treatment"
		
		drop if fc_name == "Arba Minch General Hospital"  & int_type == "1st Line TB Treatment"
		drop if fc_name == "Bole 17 Health Center" & int_type == "2nd Line TB treatment"
		drop if fc_name == "Kotebe Health Center" & int_type == "2nd Line TB treatment"
		drop if fc_name == "Logia Health Center" & int_type == "2nd Line TB treatment"
		drop if fc_name == "St Peter's Specialised Hospital" & int_type == "1st Line TB Treatment"
		drop if fc_name == "St Peter's Specialised Hospital" & int_type == "2nd Line TB treatment"

		drop if fc_name == "M3041711" & int_type=="1st Line TB Treatment"
		drop if fc_name == "M3091311" & int_type=="1st Line TB Treatment"
		drop if fc_name == "M101048P" & int_type=="1st Line TB Treatment"
		drop if fc_name == "T101424P" & int_type=="1st Line TB Treatment"
		drop if fc_name == "T101430P" & int_type=="1st Line TB Treatment"
		drop if fc_name == "T101441P" & int_type=="1st Line TB Treatment"
		drop if fc_name == "T101489P" & int_type=="1st Line TB Treatment"
		drop if fc_country == "India" & int_type == "2nd Line TB treatment"
		
		drop if fc_name == "National TB Reference Laboratory" & int_type == "2nd Line TB treatment" 
		drop if fc_name == "National TB Reference Laboratory" & int_type == "1st Line TB Treatment"
		
		drop if fc_country == "Georgia" & fc_geog1 == "Rural" & int_type == "2nd Line TB treatment"
		drop if fc_name == "Nabakevi rural ambulatory" & int_detail == "Adult_EPTB_New&relapse"
		drop if fc_name == "Nabakevi rural ambulatory" & int_detail == "Adult_PTB_New&relapse"
		drop if fc_name == "Nabakevi rural ambulatory" & int_detail == "Adult_PTB_Previously treated"
		drop if fc_name == "Shalauri Rural Ambulatory" & int_detail == "Adult_EPTB_Previously treated"
		drop if fc_name == "Shalauri Rural Ambulatory" & int_detail == "Adult_PTB_Previously treated"
		drop if fc_name == "Navazi Ambulatory " & int_detail == "Adult_PTB_New&relapse"
	

				replace fc_type = "Secondary hospital" if fc_type == "Secondary (county/general) hospital"
				replace fc_type = "Tertiary hospital" if fc_type == "Tertiary (national/ teaching/ referral/ specialised_ hospital"
				replace fc_type = "Tertiary hospital" if fc_type == "Tertiary (national/teaching/referral/specialised_ hospital"
				replace fc_type = "Tertiary hospital" if fc_type == "Tertiary (national/ teaching/ referral/ specialised) hospital"
				replace fc_type = "Community health unit" if fc_type == "Community Health Unit" | fc_type == "Community health unit"
				replace fc_type = "Reference Laboratory" if fc_type == "Reference laboratory"

		order fc_code, after(fc_country)
		order int_detail int_detail_coded int_phase2, after(int_phase)
		order met_FINvECON met_TDvBU met_currency met_currencyyear_collection met_currencyyear_reported met_*, after(fc_totalstaff_FTE)
		order met_*, after(fc_totalstaff_FTE)
		order q_* USD_* LCU_*, last
		 drop fc_name

		quietly {
			cap label var fc_country "Country"
			cap label var fc_geog1 "Geography (rural/urban)"
			cap label var fc_type "Facility level"
			cap label var fc_ownership "Facility ownership"
			cap label var fc_size_m2 "Size of facility buildings (approx m2)"
			cap label var fc_beds_total "Total inpatient beds in faciity"
			cap label var fc_beds_TB "Total inpatient TB beds in faciity"
			cap label var fc_opvisits_total "Total outpatient visits in faciity"
			cap label var fc_opvisits_TB "Total outpatient visits (TB)"
			cap label var fc_catchmentpop "Size of catchment population"
			cap label var fc_clinicalstaff_FTE "Total clinical staff FTE"
			cap label var fc_supportstaff_FTE "Total support staff FTE"
			cap label var fc_totalstaff_FTE "Total staff FTE"
			cap label var int_class "Intervention class"
			cap label var int_type "Intervention type"
			cap label var int_pop1 "Intervention population category 1"
			cap label var int_pop2 "Intervention population category 2"
			cap label var int_pop3 "Intervention population category 3"
			cap label var int_regimen "Intervention regimen"
			cap label var int_phase "Intervention phase"
			cap label var met_TDvBU "Top-Down or Bottom-Up cost estimates"
			cap label var met_FINvECON "Financial or Economic cost estimates"
			cap label var q_op_VOT "Quantity (Outpatient, video observed therapy)"
			cap label var q_op_coughtriage "Quantity (Outpatient, cough triage)"
			cap label var q_op_screeningvisit "Quantity (Outpatient, screening visit)"
			cap label var q_op_diagnosticvisit "Quantity (Outpatient, diagnostic visit)"
			cap label var q_op_DOTvisit "Quantity (Outpatient, directly observed therapy)"
			cap label var q_op_monitoringvisit "Quantity (Outpatient, monitoring visit)"
			cap label var q_op_adherencesupportvisit "Quantity (Outpatient, adherence support visit)"
			cap label var q_op_treatmentsupport "Quantity (Outpatient, treatment support)"
			cap label var q_op_vaccinations "Quantity (Outpatient, vaccinations)"
			cap label var q_op_phoneconsultation "Quantity (Outpatient, phone consultation)"
			cap label var q_op_injectionvisit "Quantity (Outpatient, injection visit)"
			cap label var q_op_treatmentvisit "Quantity (Outpatient, treatment visit)"
			cap label var q_op_childTBprev "Quantity (Outpatient, child household contact TB prevention)"
			cap label var q_op_followupvisit "Quantity (Outpatient, followup visit)"
			cap label var q_op_collectingmeds "Quantity (Outpatient, collecting medication at discharge)"
			cap label var q_op_treatmentvisit_LTBI "Quantity (Outpatient, latent TB infection treatment visit)"
			cap label var q_op_MDRDOT "Quantity (Outpatient, directly observed therapy for MDR-TB)"
			cap label var q_op_treatmentvisit_MDR "Quantity (Outpatient, MDR-TB treatment visit)"
			cap label var q_op_screeningvisit_MCH "Quantity (Outpatient, maternal/child health screening visit)"
			cap label var q_op_othervisit "Quantity (Outpatient, other visit)"
			cap label var q_ip_bedday_DS "Quantity (Inpatient, drug-sensitive TB bedday)"
			cap label var q_ip_bedday_MDR "Quantity (Inpatient, MDR-TB bedday)"
			cap label var q_ip_bedday_HIVTB "Quantity (Inpatient, HIV/TB bedday)"
			cap label var q_ip_bedday_diagnosis "Quantity (Inpatient, diagosis bedday)"
			cap label var q_ip_bedday_treatment "Quantity (Inpatient, treatment bedday)"
			cap label var q_ip_bedday "Quantity (Inpatient, bedday)"
			cap label var q_com_vaccinations "Quantity (Community, vaccinations)"
			cap label var q_com_contacttracing "Quantity (Community, contact tracing)"
			cap label var q_com_diagnosticvisit "Quantity (Community, diagnostic visit)"
			cap label var q_com_treatmentvisit "Quantity (Community, treatment visit)"
			cap label var q_com_LTFUtracing "Quantity (Community, lost-to-follow-up tracing)"
			cap label var q_com_event "Quantity (Community, event)"
			cap label var q_com_LTFUtracing_calls "Quantity (Community, lost-to-follow-up tracing by phone)"
			cap label var q_com_screeningvisit "Quantity (Community, screening visit)"
			cap label var q_com_othervisit "Quantity (Community, other visit)"
			cap label var q_oth_diagnosticsupport "Quantity (Other, diagnostic support)"
			cap label var q_oth_phoneconsultation "Quantity (Other, phone consultation with doctor or nurse)"
			cap label var q_oth_contacttracing "Quantity (Other, contact tracing by phone)"
			cap label var q_oth_LTFUtracing_homevisit "Quantity (Other, lost-to-follow-up tracing by home visit)"
			cap label var q_oth_RNTCPwork "Quantity (Other, RNTCP work)"
			cap label var q_oth_otherTBServices "Quantity (Other, other TB services)"
			cap label var q_lab_collectsputum "Quantity (Laboratory, sputum collection)"
			cap label var q_lab_smearmicroscopyzn "Quantity (Laboratory, smear microscopy, ZN)"
			cap label var q_lab_LAMP "Quantity (Laboratory, LAMP)"
			cap label var q_lab_solidculture "Quantity (Laboratory, sputum culture, solid)"
			cap label var q_lab_sputumculture "Quantity (Laboratory, sputum culture, liquid)"
			cap label var q_lab_DST_FL_solid "Quantity (Laboratory, DST for first-line, (4 drugs -H,R,E,S), solid media)"
			cap label var q_lab_DST_SL_solid "Quantity (Laboratory, DST for first line, (4 drugs -H,R,E,S), liquid media)"
			cap label var q_lab_DST_FL_liquid "Quantity (Laboratory, DST for second-line, (fluoroquinolone injectables), liquid media)"
			cap label var q_lab_DST_SL_liquid "Quantity (Laboratory, DST for second-line, (fluoroquinolone injectables), solid media)"
			cap label var q_lab_LPA_FLD "Quantity (Laboratory, line probe assay, first-line drugs)"
			cap label var q_lab_LPA_SLD "Quantity (Laboratory, line probe assay, second-line drugs)"
			cap label var q_lab_XpertMTBRIF "Quantity (Laboratory, GeneXpert MTB/RIF)"
			cap label var q_lab_LAM "Quantity (Laboratory, LAM)"
			cap label var q_lab_TSTPPDtest "Quantity (Laboratory, TST/PPD test/Mantoux test)"
			cap label var q_lab_IGRA "Quantity (Laboratory, interferon gamma release assay)"
			cap label var q_lab_ECG "Quantity (Laboratory, electrocardiogram)"
			cap label var q_lab_CD4count "Quantity (Laboratory, CD4 count)"
			cap label var q_lab_HIVrapidtest "Quantity (Laboratory, HIV rapid test)"
			cap label var q_lab_HIVconfirmatorytest "Quantity (Laboratory, HIV confirmatory test)"
			cap label var q_lab_ESR "Quantity (Laboratory, erythrocyte sedimentation rate)"
			cap label var q_lab_totalWBC "Quantity (Laboratory, total white blood cell count)"
			cap label var q_lab_fullhaemogram "Quantity (Laboratory, full haemogram)"
			cap label var q_lab_ASTorSGOT "Quantity (Laboratory, AST or SGOT)"
			cap label var q_lab_ALTorSGPT "Quantity (Laboratory, ALT or SGPT)"
			cap label var q_lab_creatinine "Quantity (Laboratory, creatinine)"
			cap label var q_lab_creatinineclearance "Quantity (Laboratory, creatinine clearance)"
			cap label var q_lab_bloodsugar "Quantity (Laboratory, blood sugar)"
			cap label var q_lab_lacticacid "Quantity (Laboratory, lactic acid)"
			cap label var q_lab_lipase "Quantity (Laboratory, lipase)"
			cap label var q_lab_TSH "Quantity (Laboratory, thyroid simulating hormone)"
			cap label var q_lab_fineneedlebiopsy "Quantity (Laboratory, fine needle biopsy)"
			cap label var q_lab_gastriclavage "Quantity (Laboratory, gastric lavage)"
			cap label var q_lab_bronchiallavage "Quantity (Laboratory, bronchial lavage)"
			cap label var q_lab_bodyfluidanalysis "Quantity (Laboratory, body fluids analysis)"
			cap label var q_lab_PCRDNA "Quantity (Laboratory, PCR-DNA (for infant diagnosis))"
			cap label var q_lab_aspiratesEPTB "Quantity (Laboratory, aspirates, extrapulmonary TB)"
			cap label var q_lab_biochemistry "Quantity (Laboratory, biochemistry (ALT, AST, Bilirubin, Creatinine))"
			cap label var q_lab_potassium "Quantity (Laboratory, potassium)"
			cap label var q_lab_audiometry "Quantity (Laboratory, audiometry)"
			cap label var q_lab_xrayallotherbody "Quantity (Laboratory, X-ray [all other body (excluding chest X-ray) - EPTB])"
			cap label var q_rad_CXRfilm "Quantity (Radiology, chest X-ray, film)"
			cap label var q_rad_CXRdigital "Quantity (Radiology, chest X-ray, digital)"
			cap label var q_lab_urinalysis "Quantity (Laboratory, urinalysis)"
			cap label var q_lab_electrolytetest "Quantity (Laboratory, electrolyte test)"
			cap label var q_lab_immunology "Quantity (Laboratory, immunology)"
			cap label var q_lab_citology "Quantity (Laboratory, citology)"
			cap label var q_lab_bloodgroupRH "Quantity (Laboratory, blood group & RH)"
			cap label var q_lab_BodyFluids "Quantity (Laboratory, body fluids analysis)"
			cap label var q_lab_cerebrospinalfluid "Quantity (Laboratory, cerebrospinal fluid)"
			cap label var q_lab_bloodclotting "Quantity (Laboratory, blood clotting)"
			cap label var q_lab_HEPCtest "Quantity (Laboratory, hepatitis C test)"
			cap label var q_lab_renalfunctiontest "Quantity (Laboratory, renal function tests)"
			cap label var q_lab_liverfunctiontest "Quantity (Laboratory, liver function tests)"
			cap label var q_lab_TBPCRadult "Quantity (Laboratory, TB-polymerase chain reaction, adult)"
			cap label var q_lab_smearpreparation "Quantity (Laboratory, smear preparation)"
			cap label var q_lab_alkalinephosphatase "Quantity (Laboratory, alkaline phosphatase)"
			cap label var q_lab_bilirubin "Quantity (Laboratory, bilirubin)"
			cap label var q_lab_protein "Quantity (Laboratory, protein)"
			cap label var q_lab_albumin "Quantity (Laboratory, albumin)"
			cap label var q_lab_bloodureanitrogen "Quantity (Laboratory, blood urea nitrogen)"
			cap label var q_lab_HBsAg "Quantity (Laboratory, hepatitis B surface antigen test)"
			cap label var q_lab_VDRL "Quantity (Laboratory, venereal disease research laboratory test)"
			cap label var q_lab_uricacid "Quantity (Laboratory, uric acid)"
			cap label var q_lab_pregnancytest "Quantity (Laboratory, pregnancy test)"
			cap label var q_lab_LEDFM_culture "Quantity (Laboratory, LED-FM culture)"
			cap label var q_lab_LEDFMmicroscopy "Quantity (Laboratory, LED-FM microscopy)"
			cap label var q_lab_pleuraltapping "Quantity (Laboratory, pleural tapping)"
			cap label var q_lab_collectsputum_Xpert "Quantity (Laboratory, sputum collection for GeneXpert)"
			cap label var q_lab_viralload "Quantity (Laboratory, viral load)"
			cap label var q_lab_EID "Quantity (Laboratory, early infant diagnosis)"
			cap label var q_lab_TBCulture "Quantity (Laboratory, TB culture)"
			cap label var q_lab_LFT_UEC "Quantity (Laboratory, liver function tests, urea and electrolytes)"
			cap label var q_lab_haematological "Quantity (Laboratory, full haemogram and erythrocyte sedimentation rate)"
			cap label var q_lab_DBS "Quantity (Laboratory, dried blood spot test)"
			cap label var q_lab_HBestimation "Quantity (Laboratory, hemoglobin estimation)"
			cap label var q_lab_RBS "Quantity (Laboratory, random blood sugar)"
			cap label var q_lab_LPA "Quantity (Laboratory, line probe assay)"
			cap label var q_lab_BHIagar "Quantity (Laboratory, brain heart infusion agar)"
			cap label var q_lab_serology "Quantity (Laboratory, serology)"
			cap label var q_lab_Viralload "Quantity (Laboratory, viral load)"
			cap label var q_lab_HgbHCT "Quantity (Laboratory, hemoglobin/hematocrit)"
			cap label var q_lab_SputumCollection "Quantity (Laboratory, sputum collection)"
			cap label var q_lab_fastingbloodsugar "Quantity (Laboratory, fasting blood sugar)"
			cap label var q_lab_serumuricacid "Quantity (Laboratory, serum uric acid)"
			cap label var q_lab_magnesium "Quantity (Laboratory, magnesium)"
			cap label var q_lab_collectsputum_LPA "Quantity (Laboratory, sputum collection for line probe assay)"
			cap label var q_lab_collectsputum_culture "Quantity (Laboratory, sputum collection for culture)"
			cap label var q_lab_collectsputum_DST "Quantity (Laboratory, sputum collection for drug sensitivity testing)"
			cap label var q_lab_transportofblood "Quantity (Laboratory, transport of blood)"
			cap label var q_lab_collectsputum_smearZN "Quantity (Laboratory, sputum collection for smear ZN)"
			cap label var q_lab_visualacuity "Quantity (Laboratory, visual acuity)"
			cap label var q_rad_CT "Quantity (Radiology, CT scan)"
			cap label var q_rad_MRI "Quantity (Radiology, MRI)"
			cap label var q_rad_ultrasound "Quantity (Radiology, ultrasound)"
			cap label var q_rad_Cardioultrasound "Quantity (Radiology, ultrasound)"
			cap label var q_rad_filmprocessing_Xray "Quantity (Radiology, film processing for X-ray)"
			cap label var LCU_uc_op_VOT "Unit cost (Outpatient, video observed therapy), LCU"
			cap label var LCU_uc_op_coughtriage "Unit cost (Outpatient, cough triage), LCU"
			cap label var LCU_uc_op_screeningvisit "Unit cost (Outpatient, screening visit), LCU"
			cap label var LCU_uc_op_diagnosticvisit "Unit cost (Outpatient, diagnostic visit), LCU"
			cap label var LCU_uc_op_DOTvisit "Unit cost (Outpatient, directly observed therapy), LCU"
			cap label var LCU_uc_op_monitoringvisit "Unit cost (Outpatient, monitoring visit), LCU"
			cap label var LCU_uc_op_adherencesupportvisit "Unit cost (Outpatient, adherence support visit), LCU"
			cap label var LCU_uc_op_treatmentsupport "Unit cost (Other, treatment support), LCU"
			cap label var LCU_uc_op_vaccinations "Unit cost (Outpatient, vaccinations), LCU"
			cap label var LCU_uc_op_injectionvisit "Unit cost (Outpatient, injection visit), LCU"
			cap label var LCU_uc_op_treatmentvisit "Unit cost (Outpatient, treatment visit), LCU"
			cap label var LCU_uc_op_followupvisit "Unit cost (Outpatient, followup visit), LCU"
			cap label var LCU_uc_op_collectingmeds "Unit cost (Outpatient, collecting medication at discharge), LCU"
			cap label var LCU_uc_op_treatmentvisit_LTBI "Unit cost (Outpatient, latent TB infection treatment visit), LCU"
			cap label var LCU_uc_op_MDRDOT "Unit cost (Outpatient, directly observed therapy for MDR-TB), LCU"
			cap label var LCU_uc_op_treatmentvisit_MDR "Unit cost (Outpatient, MDR-TB treatment visit), LCU"
			cap label var LCU_uc_op_screeningvisit_MCH "Unit cost (Outpatient, TB screening in maternal/child health department), LCU"
			cap label var LCU_uc_ip_bedday_DS "Unit cost (Inpatient, drug-sensitive TB bedday), LCU"
			cap label var LCU_uc_ip_bedday_MDR "Unit cost (Inpatient, MDR-TB bedday), LCU"
			cap label var LCU_uc_ip_bedday_HIVTB "Unit cost (Inpatient, HIV/TB bedday), LCU"
			cap label var LCU_uc_ip_bedday_diagnosis "Unit cost (Inpatient, diagosis bedday), LCU"
			cap label var LCU_uc_ip_bedday_treatment "Unit cost (Inpatient, treatment bedday), LCU"
			cap label var LCU_uc_ip_bedday "Unit cost (Inpatient, bedday), LCU"
			cap label var LCU_uc_com_vaccinations "Unit cost (Community, vaccinations), LCU"
			cap label var LCU_uc_com_contacttracing "Unit cost (Community, contact tracing), LCU"
			cap label var LCU_uc_com_treatmentvisit "Unit cost (Community, treatment visit), LCU"
			cap label var LCU_uc_com_event "Unit cost (Community, event), LCU"
			cap label var LCU_uc_com_LTFUtracing_calls "Unit cost (Community, lost-to-follow-up tracing by phone), LCU"
			cap label var LCU_uc_com_screeningvisit "Unit cost (Community, screening visit), LCU"
			cap label var LCU_uc_com_othervisit "Unit cost (Community, other visit), LCU"
			cap label var LCU_uc_oth_diagnosticsupport "Unit cost (Other, diagnostic support), LCU"
			cap label var LCU_uc_oth_phoneconsultation "Unit cost (Other, phone consultation with doctor or nurse), LCU"
			cap label var LCU_uc_oth_contacttracing "Unit cost (Other, contact tracing by phone), LCU"
			cap label var LCU_uc_oth_LTFUtracing_homevisit "Unit cost (Other, lost-to-follow-up tracing by home visit), LCU"
			cap label var LCU_uc_lab_collectsputum "Unit cost (Laboratory, sputum collection), LCU"
			cap label var LCU_uc_lab_smearmicroscopyzn "Unit cost (Laboratory, smear microscopy, ZN), LCU"
			cap label var LCU_uc_lab_solidculture "Unit cost (Laboratory, sputum culture, solid), LCU"
			cap label var LCU_uc_lab_sputumculture "Unit cost (Laboratory, sputum culture, liquid), LCU"
			cap label var LCU_uc_lab_DST_FL_solid "Unit cost (Laboratory, DST for first-line, (4 drugs -H,R,E,S), solid media), LCU"
			cap label var LCU_uc_lab_DST_FL_liquid "Unit cost (Laboratory, DST for first line, (4 drugs -H,R,E,S), liquid media), LCU"
			cap label var LCU_uc_lab_DST_SL_liquid "Unit cost (Laboratory, DST for second-line, (fluoroquinolone injectables), liquid media), LCU"
			cap label var LCU_uc_lab_LPA_FLD "Unit cost (Laboratory, line probe assay, first-line drugs), LCU"
			cap label var LCU_uc_lab_LPA_SLD "Unit cost (Laboratory, line probe assay, second-line drugs), LCU"
			cap label var LCU_uc_lab_XpertMTBRIF "Unit cost (Laboratory, GeneXpert MTB/RIF), LCU"
			cap label var LCU_uc_lab_LAM "Unit cost (Laboratory, LAM), LCU"
			cap label var LCU_uc_lab_TSTPPDtest "Unit cost (Laboratory, TST/PPD test/Mantoux test), LCU"
			cap label var LCU_uc_lab_IGRA "Unit cost (Laboratory, interferon gamma release assay), LCU"
			cap label var LCU_uc_lab_ECG "Unit cost (Laboratory, electrocardiogram), LCU"
			cap label var LCU_uc_lab_CD4count "Unit cost (Laboratory, CD4 count), LCU"
			cap label var LCU_uc_lab_HIVrapidtest "Unit cost (Laboratory, HIV rapid test), LCU"
			cap label var LCU_uc_lab_HIVconfirmatorytest "Unit cost (Laboratory, HIV confirmatory test), LCU"
			cap label var LCU_uc_lab_ESR "Unit cost (Laboratory, erythrocyte sedimentation rate), LCU"
			cap label var LCU_uc_lab_totalWBC "Unit cost (Laboratory, total white blood cell count), LCU"
			cap label var LCU_uc_lab_fullhaemogram "Unit cost (Laboratory, full haemogram), LCU"
			cap label var LCU_uc_lab_ASTorSGOT "Unit cost (Laboratory, AST or SGOT), LCU"
			cap label var LCU_uc_lab_ALTorSGPT "Unit cost (Laboratory, ALT or SGPT), LCU"
			cap label var LCU_uc_lab_creatinine "Unit cost (Laboratory, creatinine), LCU"
			cap label var LCU_uc_lab_bloodsugar "Unit cost (Laboratory, blood sugar), LCU"
			cap label var LCU_uc_lab_bodyfluidanalysis "Unit cost (Laboratory, body fluids analysis), LCU"
			cap label var LCU_uc_lab_PCRDNA "Unit cost (Laboratory, PCR-DNA (for infant diagnosis)), LCU"
			cap label var LCU_uc_lab_aspiratesEPTB "Unit cost (Laboratory, aspirates, extrapulmonary TB), LCU"
			cap label var LCU_uc_lab_biochemistry "Unit cost (Laboratory, biochemistry (ALT, AST, Bilirubin, Creatinine)), LCU"
			cap label var LCU_uc_lab_potassium "Unit cost (Laboratory, potassium), LCU"
			cap label var LCU_uc_lab_audiometry "Unit cost (Laboratory, audiometry), LCU"
			cap label var LCU_uc_lab_xrayallotherbody "Unit cost (Laboratory, X-ray [all other body (excluding chest X-ray) - EPTB]), LCU"
			cap label var LCU_uc_rad_CXRfilm "Unit cost (Radiology, chest X-ray, film), LCU"
			cap label var LCU_uc_rad_CXRdigital "Unit cost (Radiology, chest X-ray, digital), LCU"
			cap label var LCU_uc_lab_urinalysis "Unit cost (Laboratory, urinalysis), LCU"
			cap label var LCU_uc_lab_electrolytetest "Unit cost (Laboratory, electrolyte test), LCU"
			cap label var LCU_uc_lab_immunology "Unit cost (Laboratory, immunology), LCU"
			cap label var LCU_uc_lab_citology "Unit cost (Laboratory, citology), LCU"
			cap label var LCU_uc_lab_bloodgroupRH "Unit cost (Laboratory, blood group & RH), LCU"
			cap label var LCU_uc_lab_BodyFluids "Unit cost (Laboratory, body fluids analysis), LCU"
			cap label var LCU_uc_lab_cerebrospinalfluid "Unit cost (Laboratory, cerebrospinal fluid), LCU"
			cap label var LCU_uc_lab_bloodclotting "Unit cost (Laboratory, blood clotting), LCU"
			cap label var LCU_uc_lab_HEPCtest "Unit cost (Laboratory, hepatitis C test), LCU"
			cap label var LCU_uc_lab_renalfunctiontest "Unit cost (Laboratory, renal function tests), LCU"
			cap label var LCU_uc_lab_liverfunctiontest "Unit cost (Laboratory, liver function tests), LCU"
			cap label var LCU_uc_lab_TBPCRadult "Unit cost (Laboratory, TB-polymerase chain reaction, adult), LCU"
			cap label var LCU_uc_lab_alkalinephosphatase "Unit cost (Laboratory, alkaline phosphatase), LCU"
			cap label var LCU_uc_lab_bilirubin "Unit cost (Laboratory, bilirubin), LCU"
			cap label var LCU_uc_lab_protein "Unit cost (Laboratory, protein), LCU"
			cap label var LCU_uc_lab_albumin "Unit cost (Laboratory, albumin), LCU"
			cap label var LCU_uc_lab_bloodureanitrogen "Unit cost (Laboratory, blood urea nitrogen), LCU"
			cap label var LCU_uc_lab_HBsAg "Unit cost (Laboratory, hepatitis B surface antigen test), LCU"
			cap label var LCU_uc_lab_VDRL "Unit cost (Laboratory, venereal disease research laboratory test), LCU"
			cap label var LCU_uc_lab_uricacid "Unit cost (Laboratory, uric acid), LCU"
			cap label var LCU_uc_lab_pregnancytest "Unit cost (Laboratory, pregnancy test), LCU"
			cap label var LCU_uc_lab_LEDFM_culture "Unit cost (Laboratory, LED-FM culture), LCU"
			cap label var LCU_uc_lab_LEDFMmicroscopy "Unit cost (Laboratory, LED-FM microscopy), LCU"
			cap label var LCU_uc_lab_pleuraltapping "Unit cost (Laboratory, pleural tapping), LCU"
			cap label var LCU_uc_lab_collectsputum_Xpert "Unit cost (Laboratory, sputum collection for GeneXpert), LCU"
			cap label var LCU_uc_lab_HBestimation "Unit cost (Laboratory, hemoglobin estimation), LCU"
			cap label var LCU_uc_lab_LPA "Unit cost (Laboratory, line probe assay), LCU"
			cap label var LCU_uc_lab_serology "Unit cost (Laboratory, serology), LCU"
			cap label var LCU_uc_lab_Viralload "Unit cost (Laboratory, viral load), LCU"
			cap label var LCU_uc_lab_HgbHCT "Unit cost (Laboratory, hemoglobin/hematocrit), LCU"
			cap label var LCU_uc_lab_SputumCollection "Unit cost (Laboratory, sputum collection), LCU"
			cap label var LCU_uc_lab_fastingbloodsugar "Unit cost (Laboratory, fasting blood sugar), LCU"
			cap label var LCU_uc_lab_serumuricacid "Unit cost (Laboratory, serum uric acid), LCU"
			cap label var LCU_uc_lab_magnesium "Unit cost (Laboratory, magnesium), LCU"
			cap label var LCU_uc_lab_collectsputum_LPA "Unit cost (Laboratory, sputum collection for line probe assay), LCU"
			cap label var LCU_uc_lab_collectsputum_culture "Unit cost (Laboratory, sputum collection for culture), LCU"
			cap label var LCU_uc_lab_collectsputum_DST "Unit cost (Laboratory, sputum collection for drug sensitivity testing), LCU"
			cap label var LCU_uc_lab_collectsputum_smearZN "Unit cost (Laboratory, sputum collection for smear ZN), LCU"
			cap label var LCU_uc_lab_visualacuity "Unit cost (Laboratory, visual acuity), LCU"
			cap label var LCU_uc_rad_CT "Unit cost (Radiology, CT scan), LCU"
			cap label var LCU_uc_rad_MRI "Unit cost (Radiology, MRI), LCU"
			cap label var LCU_uc_rad_ultrasound "Unit cost (Radiology, ultrasound), LCU"
			cap label var LCU_uc_rad_filmprocessing_Xray "Unit cost (Radiology, film processing for X-ray), LCU"
			cap label var LCU_tc_op_VOT "Total cost (Outpatient, video observed therapy), LCU"
			cap label var LCU_tc_op_coughtriage "Total cost (Outpatient, cough triage), LCU"
			cap label var LCU_tc_op_screeningvisit "Total cost (Outpatient, screening visit), LCU"
			cap label var LCU_tc_op_diagnosticvisit "Total cost (Outpatient, diagnostic visit), LCU"
			cap label var LCU_tc_op_DOTvisit "Total cost (Outpatient, directly observed therapy), LCU"
			cap label var LCU_tc_op_monitoringvisit "Total cost (Outpatient, monitoring visit), LCU"
			cap label var LCU_tc_op_adherencesupportvisit "Total cost (Outpatient, adherence support visit), LCU"
			cap label var LCU_tc_op_treatmentsupport "Total cost (Other, treatment support), LCU"
			cap label var LCU_tc_op_vaccinations "Total cost (Outpatient, vaccinations), LCU"
			cap label var LCU_tc_op_injectionvisit "Total cost (Outpatient, injection visit), LCU"
			cap label var LCU_tc_op_treatmentvisit "Total cost (Outpatient, treatment visit), LCU"
			cap label var LCU_tc_op_followupvisit "Total cost (Outpatient, followup visit), LCU"
			cap label var LCU_tc_op_collectingmeds "Total cost (Outpatient, collecting medication at discharge), LCU"
			cap label var LCU_tc_op_treatmentvisit_LTBI "Total cost (Outpatient, latent TB infection treatment visit), LCU"
			cap label var LCU_tc_op_MDRDOT "Total cost (Outpatient, directly observed therapy for MDR-TB), LCU"
			cap label var LCU_tc_op_treatmentvisit_MDR "Total cost (Outpatient, MDR-TB treatment visit), LCU"
			cap label var LCU_tc_op_screeningvisit_MCH "Total cost (Outpatient, maternal/child health screening visit), LCU"
			cap label var LCU_tc_ip_bedday_DS "Total cost (Inpatient, drug-sensitive TB bedday), LCU"
			cap label var LCU_tc_ip_bedday_MDR "Total cost (Inpatient, MDR-TB bedday), LCU"
			cap label var LCU_tc_ip_bedday_HIVTB "Total cost (Inpatient, HIV/TB bedday), LCU"
			cap label var LCU_tc_ip_bedday_diagnosis "Total cost (Inpatient, diagosis bedday), LCU"
			cap label var LCU_tc_ip_bedday_treatment "Total cost (Inpatient, treatment bedday), LCU"
			cap label var LCU_tc_ip_bedday "Total cost (Inpatient, bedday), LCU"
			cap label var LCU_tc_com_vaccinations "Total cost (Community, vaccinations), LCU"
			cap label var LCU_tc_com_contacttracing "Total cost (Community, contact tracing), LCU"
			cap label var LCU_tc_com_treatmentvisit "Total cost (Community, treatment visit), LCU"
			cap label var LCU_tc_com_event "Total cost (Community, event), LCU"
			cap label var LCU_tc_com_LTFUtracing_calls "Total cost (Community, lost-to-follow-up tracing by phone), LCU"
			cap label var LCU_tc_com_screeningvisit "Total cost (Community, screening visit), LCU"
			cap label var LCU_tc_com_othervisit "Total cost (Community, other visit), LCU"
			cap label var LCU_tc_oth_diagnosticsupport "Total cost (Other, diagnostic support), LCU"
			cap label var LCU_tc_oth_phoneconsultation "Total cost (Other, phone consultation with doctor or nurse), LCU"
			cap label var LCU_tc_oth_contacttracing "Total cost (Other, contact tracing by phone), LCU"
			cap label var LCU_tc_oth_LTFUtracing_homevisit "Total cost (Other, lost-to-follow-up tracing by home visit), LCU"
			cap label var LCU_tc_lab_collectsputum "Total cost (Laboratory, sputum collection), LCU"
			cap label var LCU_tc_lab_smearmicroscopyzn "Total cost (Laboratory, smear microscopy, ZN), LCU"
			cap label var LCU_tc_lab_solidculture "Total cost (Laboratory, sputum culture, solid), LCU"
			cap label var LCU_tc_lab_sputumculture "Total cost (Laboratory, sputum culture, liquid), LCU"
			cap label var LCU_tc_lab_DST_FL_solid "Total cost (Laboratory, DST for first-line, (4 drugs -H,R,E,S), solid media), LCU"
			cap label var LCU_tc_lab_DST_FL_liquid "Total cost (Laboratory, DST for first line, (4 drugs -H,R,E,S), liquid media), LCU"
			cap label var LCU_tc_lab_DST_SL_liquid "Total cost (Laboratory, DST for second-line, (fluoroquinolone injectables), liquid media), LCU"
			cap label var LCU_tc_lab_LPA_FLD "Total cost (Laboratory, line probe assay, first-line drugs), LCU"
			cap label var LCU_tc_lab_LPA_SLD "Total cost (Laboratory, line probe assay, second-line drugs), LCU"
			cap label var LCU_tc_lab_XpertMTBRIF "Total cost (Laboratory, GeneXpert MTB/RIF), LCU"
			cap label var LCU_tc_lab_LAM "Total cost (Laboratory, LAM), LCU"
			cap label var LCU_tc_lab_TSTPPDtest "Total cost (Laboratory, TST/PPD test/Mantoux test), LCU"
			cap label var LCU_tc_lab_IGRA "Total cost (Laboratory, interferon gamma release assay), LCU"
			cap label var LCU_tc_lab_ECG "Total cost (Laboratory, electrocardiogram), LCU"
			cap label var LCU_tc_lab_CD4count "Total cost (Laboratory, CD4 count), LCU"
			cap label var LCU_tc_lab_HIVrapidtest "Total cost (Laboratory, HIV rapid test), LCU"
			cap label var LCU_tc_lab_HIVconfirmatorytest "Total cost (Laboratory, HIV confirmatory test), LCU"
			cap label var LCU_tc_lab_ESR "Total cost (Laboratory, erythrocyte sedimentation rate), LCU"
			cap label var LCU_tc_lab_totalWBC "Total cost (Laboratory, total white blood cell count), LCU"
			cap label var LCU_tc_lab_fullhaemogram "Total cost (Laboratory, full haemogram), LCU"
			cap label var LCU_tc_lab_ASTorSGOT "Total cost (Laboratory, AST or SGOT), LCU"
			cap label var LCU_tc_lab_ALTorSGPT "Total cost (Laboratory, ALT or SGPT), LCU"
			cap label var LCU_tc_lab_creatinine "Total cost (Laboratory, creatinine), LCU"
			cap label var LCU_tc_lab_bloodsugar "Total cost (Laboratory, blood sugar), LCU"
			cap label var LCU_tc_lab_bodyfluidanalysis "Total cost (Laboratory, body fluids analysis), LCU"
			cap label var LCU_tc_lab_PCRDNA "Total cost (Laboratory, PCR-DNA (for infant diagnosis)), LCU"
			cap label var LCU_tc_lab_aspiratesEPTB "Total cost (Laboratory, aspirates, extrapulmonary TB), LCU"
			cap label var LCU_tc_lab_biochemistry "Total cost (Laboratory, biochemistry (ALT, AST, Bilirubin, Creatinine)), LCU"
			cap label var LCU_tc_lab_potassium "Total cost (Laboratory, potassium), LCU"
			cap label var LCU_tc_lab_audiometry "Total cost (Laboratory, audiometry), LCU"
			cap label var LCU_tc_lab_xrayallotherbody "Total cost (Laboratory, X-ray [all other body (excluding chest X-ray) - EPTB]), LCU"
			cap label var LCU_tc_rad_CXRfilm "Total cost (Radiology, chest X-ray, film), LCU"
			cap label var LCU_tc_rad_CXRdigital "Total cost (Radiology, chest X-ray, digital), LCU"
			cap label var LCU_tc_lab_urinalysis "Total cost (Laboratory, urinalysis), LCU"
			cap label var LCU_tc_lab_electrolytetest "Total cost (Laboratory, electrolyte test), LCU"
			cap label var LCU_tc_lab_immunology "Total cost (Laboratory, immunology), LCU"
			cap label var LCU_tc_lab_citology "Total cost (Laboratory, citology), LCU"
			cap label var LCU_tc_lab_bloodgroupRH "Total cost (Laboratory, blood group & RH), LCU"
			cap label var LCU_tc_lab_BodyFluids "Total cost (Laboratory, body fluids analysis), LCU"
			cap label var LCU_tc_lab_cerebrospinalfluid "Total cost (Laboratory, cerebrospinal fluid), LCU"
			cap label var LCU_tc_lab_bloodclotting "Total cost (Laboratory, blood clotting), LCU"
			cap label var LCU_tc_lab_HEPCtest "Total cost (Laboratory, hepatitis C test), LCU"
			cap label var LCU_tc_lab_renalfunctiontest "Total cost (Laboratory, renal function tests), LCU"
			cap label var LCU_tc_lab_liverfunctiontest "Total cost (Laboratory, liver function tests), LCU"
			cap label var LCU_tc_lab_TBPCRadult "Total cost (Laboratory, TB-polymerase chain reaction, adult), LCU"
			cap label var LCU_tc_lab_alkalinephosphatase "Total cost (Laboratory, alkaline phosphatase), LCU"
			cap label var LCU_tc_lab_bilirubin "Total cost (Laboratory, bilirubin), LCU"
			cap label var LCU_tc_lab_protein "Total cost (Laboratory, protein), LCU"
			cap label var LCU_tc_lab_albumin "Total cost (Laboratory, albumin), LCU"
			cap label var LCU_tc_lab_bloodureanitrogen "Total cost (Laboratory, blood urea nitrogen), LCU"
			cap label var LCU_tc_lab_HBsAg "Total cost (Laboratory, hepatitis B surface antigen test), LCU"
			cap label var LCU_tc_lab_VDRL "Total cost (Laboratory, venereal disease research laboratory test), LCU"
			cap label var LCU_tc_lab_uricacid "Total cost (Laboratory, uric acid), LCU"
			cap label var LCU_tc_lab_pregnancytest "Total cost (Laboratory, pregnancy test), LCU"
			cap label var LCU_tc_lab_LEDFM_culture "Total cost (Laboratory, LED-FM culture), LCU"
			cap label var LCU_tc_lab_LEDFMmicroscopy "Total cost (Laboratory, LED-FM microscopy), LCU"
			cap label var LCU_tc_lab_pleuraltapping "Total cost (Laboratory, pleural tapping), LCU"
			cap label var LCU_tc_lab_collectsputum_Xpert "Total cost (Laboratory, sputum collection for GeneXpert), LCU"
			cap label var LCU_tc_lab_HBestimation "Total cost (Laboratory, hemoglobin estimation), LCU"
			cap label var LCU_tc_lab_LPA "Total cost (Laboratory, line probe assay), LCU"
			cap label var LCU_tc_lab_serology "Total cost (Laboratory, serology), LCU"
			cap label var LCU_tc_lab_Viralload "Total cost (Laboratory, viral load), LCU"
			cap label var LCU_tc_lab_HgbHCT "Total cost (Laboratory, hemoglobin/hematocrit), LCU"
			cap label var LCU_tc_lab_SputumCollection "Total cost (Laboratory, sputum collection), LCU"
			cap label var LCU_tc_lab_fastingbloodsugar "Total cost (Laboratory, fasting blood sugar), LCU"
			cap label var LCU_tc_lab_serumuricacid "Total cost (Laboratory, serum uric acid), LCU"
			cap label var LCU_tc_lab_magnesium "Total cost (Laboratory, magnesium), LCU"
			cap label var LCU_tc_lab_collectsputum_LPA "Total cost (Laboratory, sputum collection for line probe assay), LCU"
			cap label var LCU_tc_lab_collectsputum_culture "Total cost (Laboratory, sputum collection for culture), LCU"
			cap label var LCU_tc_lab_collectsputum_DST "Total cost (Laboratory, sputum collection for drug sensitivity testing), LCU"
			cap label var LCU_tc_lab_collectsputum_smearZN "Total cost (Laboratory, sputum collection for smear ZN), LCU"
			cap label var LCU_tc_lab_visualacuity "Total cost (Laboratory, visual acuity), LCU"
			cap label var LCU_tc_rad_CT "Total cost (Radiology, CT scan), LCU"
			cap label var LCU_tc_rad_MRI "Total cost (Radiology, MRI), LCU"
			cap label var LCU_tc_rad_ultrasound "Total cost (Radiology, ultrasound), LCU"
			cap label var LCU_tc_rad_filmprocessing_Xray "Total cost (Radiology, film processing for X-ray), LCU"
			cap label var LCU_tc_drugs "Total cost (Drugs), LCU"
			cap label var USD_uc_op_VOT "Unit cost (Outpatient, video observed therapy), USD"
			cap label var USD_uc_op_coughtriage "Unit cost (Outpatient, cough triage), USD"
			cap label var USD_uc_op_screeningvisit "Unit cost (Outpatient, screening visit), USD"
			cap label var USD_uc_op_diagnosticvisit "Unit cost (Outpatient, diagnostic visit), USD"
			cap label var USD_uc_op_DOTvisit "Unit cost (Outpatient, directly observed therapy), USD"
			cap label var USD_uc_op_monitoringvisit "Unit cost (Outpatient, monitoring visit), USD"
			cap label var USD_uc_op_adherencesupportvisit "Unit cost (Outpatient, adherence support visit), USD"
			cap label var USD_uc_op_treatmentsupport "Unit cost (Other, treatment support), USD"
			cap label var USD_uc_op_vaccinations "Unit cost (Outpatient, vaccinations), USD"
			cap label var USD_uc_op_injectionvisit "Unit cost (Outpatient, injection visit), USD"
			cap label var USD_uc_op_treatmentvisit "Unit cost (Outpatient, treatment visit), USD"
			cap label var USD_uc_op_followupvisit "Unit cost (Outpatient, followup visit), USD"
			cap label var USD_uc_op_collectingmeds "Unit cost (Outpatient, collecting medication at discharge), USD"
			cap label var USD_uc_op_treatmentvisit_LTBI "Unit cost (Outpatient, latent TB infection treatment visit), USD"
			cap label var USD_uc_op_MDRDOT "Unit cost (Outpatient, directly observed therapy for MDR-TB), USD"
			cap label var USD_uc_op_treatmentvisit_MDR "Unit cost (Outpatient, MDR-TB treatment visit), USD"
			cap label var USD_uc_op_screeningvisit_MCH "Unit cost (Outpatient, maternal/child health screening visit), USD"
			cap label var USD_uc_ip_bedday_DS "Unit cost (Inpatient, drug-sensitive TB bedday), USD"
			cap label var USD_uc_ip_bedday_MDR "Unit cost (Inpatient, MDR-TB bedday), USD"
			cap label var USD_uc_ip_bedday_HIVTB "Unit cost (Inpatient, HIV/TB bedday), USD"
			cap label var USD_uc_ip_bedday_diagnosis "Unit cost (Inpatient, diagosis bedday), USD"
			cap label var USD_uc_ip_bedday_treatment "Unit cost (Inpatient, treatment bedday), USD"
			cap label var USD_uc_ip_bedday "Unit cost (Inpatient, bedday), USD"
			cap label var USD_uc_com_vaccinations "Unit cost (Community, vaccinations), USD"
			cap label var USD_uc_com_contacttracing "Unit cost (Community, contact tracing), USD"
			cap label var USD_uc_com_treatmentvisit "Unit cost (Community, treatment visit), USD"
			cap label var USD_uc_com_event "Unit cost (Community, event), USD"
			cap label var USD_uc_com_LTFUtracing_calls "Unit cost (Community, lost-to-follow-up tracing by phone), USD"
			cap label var USD_uc_com_screeningvisit "Unit cost (Community, screening visit), USD"
			cap label var USD_uc_com_othervisit "Unit cost (Community, other visit), USD"
			cap label var USD_uc_oth_diagnosticsupport "Unit cost (Other, diagnostic support), USD"
			cap label var USD_uc_oth_phoneconsultation "Unit cost (Other, phone consultation with doctor or nurse), USD"
			cap label var USD_uc_oth_contacttracing "Unit cost (Other, contact tracing by phone), USD"
			cap label var USD_uc_oth_LTFUtracing_homevisit "Unit cost (Other, lost-to-follow-up tracing by home visit), USD"
			cap label var USD_uc_lab_collectsputum "Unit cost (Laboratory, sputum collection), USD"
			cap label var USD_uc_lab_smearmicroscopyzn "Unit cost (Laboratory, smear microscopy, ZN), USD"
			cap label var USD_uc_lab_solidculture "Unit cost (Laboratory, sputum culture, solid), USD"
			cap label var USD_uc_lab_sputumculture "Unit cost (Laboratory, sputum culture, liquid), USD"
			cap label var USD_uc_lab_DST_FL_solid "Unit cost (Laboratory, DST for first-line, (4 drugs -H,R,E,S), solid media), USD"
			cap label var USD_uc_lab_DST_FL_liquid "Unit cost (Laboratory, DST for first line, (4 drugs -H,R,E,S), liquid media), USD"
			cap label var USD_uc_lab_DST_SL_liquid "Unit cost (Laboratory, DST for second-line, (fluoroquinolone injectables), liquid media), USD"
			cap label var USD_uc_lab_LPA_FLD "Unit cost (Laboratory, line probe assay, first-line drugs), USD"
			cap label var USD_uc_lab_LPA_SLD "Unit cost (Laboratory, line probe assay, second-line drugs), USD"
			cap label var USD_uc_lab_XpertMTBRIF "Unit cost (Laboratory, GeneXpert MTB/RIF), USD"
			cap label var USD_uc_lab_LAM "Unit cost (Laboratory, LAM), USD"
			cap label var USD_uc_lab_TSTPPDtest "Unit cost (Laboratory, TST/PPD test/Mantoux test), USD"
			cap label var USD_uc_lab_IGRA "Unit cost (Laboratory, interferon gamma release assay), USD"
			cap label var USD_uc_lab_ECG "Unit cost (Laboratory, electrocardiogram), USD"
			cap label var USD_uc_lab_CD4count "Unit cost (Laboratory, CD4 count), USD"
			cap label var USD_uc_lab_HIVrapidtest "Unit cost (Laboratory, HIV rapid test), USD"
			cap label var USD_uc_lab_HIVconfirmatorytest "Unit cost (Laboratory, HIV confirmatory test), USD"
			cap label var USD_uc_lab_ESR "Unit cost (Laboratory, erythrocyte sedimentation rate), USD"
			cap label var USD_uc_lab_totalWBC "Unit cost (Laboratory, total white blood cell count), USD"
			cap label var USD_uc_lab_fullhaemogram "Unit cost (Laboratory, full haemogram), USD"
			cap label var USD_uc_lab_ASTorSGOT "Unit cost (Laboratory, AST or SGOT), USD"
			cap label var USD_uc_lab_ALTorSGPT "Unit cost (Laboratory, ALT or SGPT), USD"
			cap label var USD_uc_lab_creatinine "Unit cost (Laboratory, creatinine), USD"
			cap label var USD_uc_lab_bloodsugar "Unit cost (Laboratory, blood sugar), USD"
			cap label var USD_uc_lab_bodyfluidanalysis "Unit cost (Laboratory, body fluids analysis), USD"
			cap label var USD_uc_lab_PCRDNA "Unit cost (Laboratory, PCR-DNA (for infant diagnosis)), USD"
			cap label var USD_uc_lab_aspiratesEPTB "Unit cost (Laboratory, aspirates, extrapulmonary TB), USD"
			cap label var USD_uc_lab_biochemistry "Unit cost (Laboratory, biochemistry (ALT, AST, Bilirubin, Creatinine)), USD"
			cap label var USD_uc_lab_potassium "Unit cost (Laboratory, potassium), USD"
			cap label var USD_uc_lab_audiometry "Unit cost (Laboratory, audiometry), USD"
			cap label var USD_uc_lab_xrayallotherbody "Unit cost (Laboratory, X-ray [all other body (excluding chest X-ray) - EPTB]), USD"
			cap label var USD_uc_rad_CXRfilm "Unit cost (Radiology, chest X-ray, film), USD"
			cap label var USD_uc_rad_CXRdigital "Unit cost (Radiology, chest X-ray, digital), USD"
			cap label var USD_uc_lab_urinalysis "Unit cost (Laboratory, urinalysis), USD"
			cap label var USD_uc_lab_electrolytetest "Unit cost (Laboratory, electrolyte test), USD"
			cap label var USD_uc_lab_immunology "Unit cost (Laboratory, immunology), USD"
			cap label var USD_uc_lab_citology "Unit cost (Laboratory, citology), USD"
			cap label var USD_uc_lab_bloodgroupRH "Unit cost (Laboratory, blood group & RH), USD"
			cap label var USD_uc_lab_BodyFluids "Unit cost (Laboratory, body fluids analysis), USD"
			cap label var USD_uc_lab_cerebrospinalfluid "Unit cost (Laboratory, cerebrospinal fluid), USD"
			cap label var USD_uc_lab_bloodclotting "Unit cost (Laboratory, blood clotting), USD"
			cap label var USD_uc_lab_HEPCtest "Unit cost (Laboratory, hepatitis C test), USD"
			cap label var USD_uc_lab_renalfunctiontest "Unit cost (Laboratory, renal function tests), USD"
			cap label var USD_uc_lab_liverfunctiontest "Unit cost (Laboratory, liver function tests), USD"
			cap label var USD_uc_lab_TBPCRadult "Unit cost (Laboratory, TB-polymerase chain reaction, adult), USD"
			cap label var USD_uc_lab_alkalinephosphatase "Unit cost (Laboratory, alkaline phosphatase), USD"
			cap label var USD_uc_lab_bilirubin "Unit cost (Laboratory, bilirubin), USD"
			cap label var USD_uc_lab_protein "Unit cost (Laboratory, protein), USD"
			cap label var USD_uc_lab_albumin "Unit cost (Laboratory, albumin), USD"
			cap label var USD_uc_lab_bloodureanitrogen "Unit cost (Laboratory, blood urea nitrogen), USD"
			cap label var USD_uc_lab_HBsAg "Unit cost (Laboratory, hepatitis B surface antigen test), USD"
			cap label var USD_uc_lab_VDRL "Unit cost (Laboratory, venereal disease research laboratory test), USD"
			cap label var USD_uc_lab_uricacid "Unit cost (Laboratory, uric acid), USD"
			cap label var USD_uc_lab_pregnancytest "Unit cost (Laboratory, pregnancy test), USD"
			cap label var USD_uc_lab_LEDFM_culture "Unit cost (Laboratory, LED-FM culture), USD"
			cap label var USD_uc_lab_LEDFMmicroscopy "Unit cost (Laboratory, LED-FM microscopy), USD"
			cap label var USD_uc_lab_pleuraltapping "Unit cost (Laboratory, pleural tapping), USD"
			cap label var USD_uc_lab_collectsputum_Xpert "Unit cost (Laboratory, sputum collection for GeneXpert), USD"
			cap label var USD_uc_lab_HBestimation "Unit cost (Laboratory, hemoglobin estimation), USD"
			cap label var USD_uc_lab_LPA "Unit cost (Laboratory, line probe assay), USD"
			cap label var USD_uc_lab_serology "Unit cost (Laboratory, serology), USD"
			cap label var USD_uc_lab_Viralload "Unit cost (Laboratory, viral load), USD"
			cap label var USD_uc_lab_HgbHCT "Unit cost (Laboratory, hemoglobin/hematocrit), USD"
			cap label var USD_uc_lab_SputumCollection "Unit cost (Laboratory, sputum collection), USD"
			cap label var USD_uc_lab_fastingbloodsugar "Unit cost (Laboratory, fasting blood sugar), USD"
			cap label var USD_uc_lab_serumuricacid "Unit cost (Laboratory, serum uric acid), USD"
			cap label var USD_uc_lab_magnesium "Unit cost (Laboratory, magnesium), USD"
			cap label var USD_uc_lab_collectsputum_LPA "Unit cost (Laboratory, sputum collection for line probe assay), USD"
			cap label var USD_uc_lab_collectsputum_culture "Unit cost (Laboratory, sputum collection for culture), USD"
			cap label var USD_uc_lab_collectsputum_DST "Unit cost (Laboratory, sputum collection for drug sensitivity testing), USD"
			cap label var USD_uc_lab_collectsputum_smearZN "Unit cost (Laboratory, sputum collection for smear ZN), USD"
			cap label var USD_uc_lab_visualacuity "Unit cost (Laboratory, visual acuity), USD"
			cap label var USD_uc_rad_CT "Unit cost (Radiology, CT scan), USD"
			cap label var USD_uc_rad_MRI "Unit cost (Radiology, MRI), USD"
			cap label var USD_uc_rad_ultrasound "Unit cost (Radiology, ultrasound), USD"
			cap label var USD_uc_rad_filmprocessing_Xray "Unit cost (Radiology, film processing for X-ray), USD"
			cap label var USD_tc_op_VOT "Total cost (Outpatient, video observed therapy), USD"
			cap label var USD_tc_op_coughtriage "Total cost (Outpatient, cough triage), USD"
			cap label var USD_tc_op_screeningvisit "Total cost (Outpatient, screening visit), USD"
			cap label var USD_tc_op_diagnosticvisit "Total cost (Outpatient, diagnostic visit), USD"
			cap label var USD_tc_op_DOTvisit "Total cost (Outpatient, directly observed therapy), USD"
			cap label var USD_tc_op_monitoringvisit "Total cost (Outpatient, monitoring visit), USD"
			cap label var USD_tc_op_adherencesupportvisit "Total cost (Outpatient, adherence support visit), USD"
			cap label var USD_tc_op_treatmentsupport "Total cost (Other, treatment support), USD"
			cap label var USD_tc_op_vaccinations "Total cost (Outpatient, vaccinations), USD"
			cap label var USD_tc_op_injectionvisit "Total cost (Outpatient, injection visit), USD"
			cap label var USD_tc_op_treatmentvisit "Total cost (Outpatient, treatment visit), USD"
			cap label var USD_tc_op_followupvisit "Total cost (Outpatient, followup visit), USD"
			cap label var USD_tc_op_collectingmeds "Total cost (Outpatient, collecting medication at discharge), USD"
			cap label var USD_tc_op_treatmentvisit_LTBI "Total cost (Outpatient, latent TB infection treatment visit), USD"
			cap label var USD_tc_op_MDRDOT "Total cost (Outpatient, directly observed therapy for MDR-TB), USD"
			cap label var USD_tc_op_treatmentvisit_MDR "Total cost (Outpatient, MDR-TB treatment visit), USD"
			cap label var USD_tc_op_screeningvisit_MCH "Total cost (Outpatient, maternal/child health screening visit), USD"
			cap label var USD_tc_ip_bedday_DS "Total cost (Inpatient, drug-sensitive TB bedday), USD"
			cap label var USD_tc_ip_bedday_MDR "Total cost (Inpatient, MDR-TB bedday), USD"
			cap label var USD_tc_ip_bedday_HIVTB "Total cost (Inpatient, HIV/TB bedday), USD"
			cap label var USD_tc_ip_bedday_diagnosis "Total cost (Inpatient, diagosis bedday), USD"
			cap label var USD_tc_ip_bedday_treatment "Total cost (Inpatient, treatment bedday), USD"
			cap label var USD_tc_ip_bedday "Total cost (Inpatient, bedday), USD"
			cap label var USD_tc_com_vaccinations "Total cost (Community, vaccinations), USD"
			cap label var USD_tc_com_contacttracing "Total cost (Community, contact tracing), USD"
			cap label var USD_tc_com_treatmentvisit "Total cost (Community, treatment visit), USD"
			cap label var USD_tc_com_event "Total cost (Community, event), USD"
			cap label var USD_tc_com_LTFUtracing_calls "Total cost (Community, lost-to-follow-up tracing by phone), USD"
			cap label var USD_tc_com_screeningvisit "Total cost (Community, screening visit), USD"
			cap label var USD_tc_com_othervisit "Total cost (Community, other visit), USD"
			cap label var USD_tc_oth_diagnosticsupport "Total cost (Other, diagnostic support), USD"
			cap label var USD_tc_oth_phoneconsultation "Total cost (Other, phone consultation with doctor or nurse), USD"
			cap label var USD_tc_oth_contacttracing "Total cost (Other, contact tracing by phone), USD"
			cap label var USD_tc_oth_LTFUtracing_homevisit "Total cost (Other, lost-to-follow-up tracing by home visit), USD"
			cap label var USD_tc_lab_collectsputum "Total cost (Laboratory, sputum collection), USD"
			cap label var USD_tc_lab_smearmicroscopyzn "Total cost (Laboratory, smear microscopy, ZN), USD"
			cap label var USD_tc_lab_solidculture "Total cost (Laboratory, sputum culture, solid), USD"
			cap label var USD_tc_lab_sputumculture "Total cost (Laboratory, sputum culture, liquid), USD"
			cap label var USD_tc_lab_DST_FL_solid "Total cost (Laboratory, DST for first-line, (4 drugs -H,R,E,S), solid media), USD"
			cap label var USD_tc_lab_DST_FL_liquid "Total cost (Laboratory, DST for first line, (4 drugs -H,R,E,S), liquid media), USD"
			cap label var USD_tc_lab_DST_SL_liquid "Total cost (Laboratory, DST for second-line, (fluoroquinolone injectables), liquid media), USD"
			cap label var USD_tc_lab_LPA_FLD "Total cost (Laboratory, line probe assay, first-line drugs), USD"
			cap label var USD_tc_lab_LPA_SLD "Total cost (Laboratory, line probe assay, second-line drugs), USD"
			cap label var USD_tc_lab_XpertMTBRIF "Total cost (Laboratory, GeneXpert MTB/RIF), USD"
			cap label var USD_tc_lab_LAM "Total cost (Laboratory, LAM), USD"
			cap label var USD_tc_lab_TSTPPDtest "Total cost (Laboratory, TST/PPD test/Mantoux test), USD"
			cap label var USD_tc_lab_IGRA "Total cost (Laboratory, interferon gamma release assay), USD"
			cap label var USD_tc_lab_ECG "Total cost (Laboratory, electrocardiogram), USD"
			cap label var USD_tc_lab_CD4count "Total cost (Laboratory, CD4 count), USD"
			cap label var USD_tc_lab_HIVrapidtest "Total cost (Laboratory, HIV rapid test), USD"
			cap label var USD_tc_lab_HIVconfirmatorytest "Total cost (Laboratory, HIV confirmatory test), USD"
			cap label var USD_tc_lab_ESR "Total cost (Laboratory, erythrocyte sedimentation rate), USD"
			cap label var USD_tc_lab_totalWBC "Total cost (Laboratory, total white blood cell count), USD"
			cap label var USD_tc_lab_fullhaemogram "Total cost (Laboratory, full haemogram), USD"
			cap label var USD_tc_lab_ASTorSGOT "Total cost (Laboratory, AST or SGOT), USD"
			cap label var USD_tc_lab_ALTorSGPT "Total cost (Laboratory, ALT or SGPT), USD"
			cap label var USD_tc_lab_creatinine "Total cost (Laboratory, creatinine), USD"
			cap label var USD_tc_lab_bloodsugar "Total cost (Laboratory, blood sugar), USD"
			cap label var USD_tc_lab_bodyfluidanalysis "Total cost (Laboratory, body fluids analysis), USD"
			cap label var USD_tc_lab_PCRDNA "Total cost (Laboratory, PCR-DNA (for infant diagnosis)), USD"
			cap label var USD_tc_lab_aspiratesEPTB "Total cost (Laboratory, aspirates, extrapulmonary TB), USD"
			cap label var USD_tc_lab_biochemistry "Total cost (Laboratory, biochemistry (ALT, AST, Bilirubin, Creatinine)), USD"
			cap label var USD_tc_lab_potassium "Total cost (Laboratory, potassium), USD"
			cap label var USD_tc_lab_audiometry "Total cost (Laboratory, audiometry), USD"
			cap label var USD_tc_lab_xrayallotherbody "Total cost (Laboratory, X-ray [all other body (excluding chest X-ray) - EPTB]), USD"
			cap label var USD_tc_rad_CXRfilm "Total cost (Radiology, chest X-ray, film), USD"
			cap label var USD_tc_rad_CXRdigital "Total cost (Radiology, chest X-ray, digital), USD"
			cap label var USD_tc_lab_urinalysis "Total cost (Laboratory, urinalysis), USD"
			cap label var USD_tc_lab_electrolytetest "Total cost (Laboratory, electrolyte test), USD"
			cap label var USD_tc_lab_immunology "Total cost (Laboratory, immunology), USD"
			cap label var USD_tc_lab_citology "Total cost (Laboratory, citology), USD"
			cap label var USD_tc_lab_bloodgroupRH "Total cost (Laboratory, blood group & RH), USD"
			cap label var USD_tc_lab_BodyFluids "Total cost (Laboratory, body fluids analysis), USD"
			cap label var USD_tc_lab_cerebrospinalfluid "Total cost (Laboratory, cerebrospinal fluid), USD"
			cap label var USD_tc_lab_bloodclotting "Total cost (Laboratory, blood clotting), USD"
			cap label var USD_tc_lab_HEPCtest "Total cost (Laboratory, hepatitis C test), USD"
			cap label var USD_tc_lab_renalfunctiontest "Total cost (Laboratory, renal function tests), USD"
			cap label var USD_tc_lab_liverfunctiontest "Total cost (Laboratory, liver function tests), USD"
			cap label var USD_tc_lab_TBPCRadult "Total cost (Laboratory, TB-polymerase chain reaction, adult), USD"
			cap label var USD_tc_lab_alkalinephosphatase "Total cost (Laboratory, alkaline phosphatase), USD"
			cap label var USD_tc_lab_bilirubin "Total cost (Laboratory, bilirubin), USD"
			cap label var USD_tc_lab_protein "Total cost (Laboratory, protein), USD"
			cap label var USD_tc_lab_albumin "Total cost (Laboratory, albumin), USD"
			cap label var USD_tc_lab_bloodureanitrogen "Total cost (Laboratory, blood urea nitrogen), USD"
			cap label var USD_tc_lab_HBsAg "Total cost (Laboratory, Hepatitis B surface antigen test), USD"
			cap label var USD_tc_lab_VDRL "Total cost (Laboratory, venereal disease research laboratory test), USD"
			cap label var USD_tc_lab_uricacid "Total cost (Laboratory, uric acid), USD"
			cap label var USD_tc_lab_pregnancytest "Total cost (Laboratory, pregnancy test), USD"
			cap label var USD_tc_lab_LEDFM_culture "Total cost (Laboratory, LED-FM culture), USD"
			cap label var USD_tc_lab_LEDFMmicroscopy "Total cost (Laboratory, LED-FM microscopy), USD"
			cap label var USD_tc_lab_pleuraltapping "Total cost (Laboratory, pleural tapping), USD"
			cap label var USD_tc_lab_collectsputum_Xpert "Total cost (Laboratory, sputum collection for GeneXpert), USD"
			cap label var USD_tc_lab_HBestimation "Total cost (Laboratory, hemoglobin estimation), USD"
			cap label var USD_tc_lab_LPA "Total cost (Laboratory, line probe assay), USD"
			cap label var USD_tc_lab_serology "Total cost (Laboratory, serology), USD"
			cap label var USD_tc_lab_Viralload "Total cost (Laboratory, viral load), USD"
			cap label var USD_tc_lab_HgbHCT "Total cost (Laboratory, hemoglobin/hematocrit), USD"
			cap label var USD_tc_lab_SputumCollection "Total cost (Laboratory, sputum collection), USD"
			cap label var USD_tc_lab_fastingbloodsugar "Total cost (Laboratory, fasting blood sugar), USD"
			cap label var USD_tc_lab_serumuricacid "Total cost (Laboratory, serum uric acid), USD"
			cap label var USD_tc_lab_magnesium "Total cost (Laboratory, magnesium), USD"
			cap label var USD_tc_lab_collectsputum_LPA "Total cost (Laboratory, sputum collection for line probe assay), USD"
			cap label var USD_tc_lab_collectsputum_culture "Total cost (Laboratory, sputum collection for culture), USD"
			cap label var USD_tc_lab_collectsputum_DST "Total cost (Laboratory, sputum collection for drug sensitivity testing), USD"
			cap label var USD_tc_lab_collectsputum_smearZN "Total cost (Laboratory, sputum collection for smear ZN), USD"
			cap label var USD_tc_lab_visualacuity "Total cost (Laboratory, visual acuity), USD"
			cap label var USD_tc_rad_CT "Total cost (Radiology, CT scan), USD"
			cap label var USD_tc_rad_MRI "Total cost (Radiology, MRI), USD"
			cap label var USD_tc_rad_ultrasound "Total cost (Radiology, ultrasound), USD"
			cap label var USD_tc_rad_filmprocessing_Xray "Total cost (Radiology, film processing for X-ray), USD"
			cap label var USD_tc_drugs "Total cost (Drugs), USD"
			cap label var fc_code "Facility code"
			cap label var met_currency "Currency"
			cap label var met_currencyyear_collection "Currency year of data collection"
			cap label var met_USDexchangerate "Exchange rate (LCU to USD)"
			cap label var met_GDPdeflator "GDP deflator adjusting currency year from collection to reported"
			cap label var met_currencyyear_reported "Currency year that data is reported in"
			cap label var int_phase2 "Intervention phase, outpatient vs. inpatient"
			cap label var int_detail "Concatenated intervention detail"
			cap label var int_detail_coded "Concatenated intervention detail, coded"
			cap label var USD_uc_op_phoneconsultation "Unit cost (Outpatient, phone consultation with doctor or nurse), USD"
			cap label var LCU_uc_op_phoneconsultation "Unit cost (Outpatient, phone consultation with doctor or nurse), LCU"
			cap label var USD_tc_op_phoneconsultation "Unit cost (Outpatient, phone consultation with doctor or nurse), USD"
			cap label var LCU_tc_op_phoneconsultation "Unit cost (Outpatient, phone consultation with doctor or nurse), LCU"
			cap label var USD_uc_op_childTBprev "Unit cost (Outpatient, child household contact TB prevention), USD"
			cap label var LCU_uc_op_childTBprev "Unit cost (Outpatient, child household contact TB prevention), LCU"
			cap label var USD_tc_op_childTBprev "Total cost (Outpatient, child household contact TB prevention), USD"
			cap label var LCU_tc_op_childTBprev "Total cost (Outpatient, child household contact TB prevention), LCU"
			cap label var USD_uc_op_othervisit "Unit cost (Outpatient, other visit), USD"
			cap label var LCU_uc_op_othervisit "Unit cost (Outpatient, other visit), LCU"
			cap label var USD_tc_op_othervisit "Total cost (Outpatient, other visit), USD"
			cap label var LCU_tc_op_othervisit "Total cost (Outpatient, other visit), LCU"
			cap label var USD_uc_com_diagnosticvisit "Unit cost (Community, diagnostic visit), USD"
			cap label var USD_tc_com_diagnosticvisit "Total cost (Community, diagnostic visit), USD"
			cap label var LCU_uc_com_diagnosticvisit "Unit cost (Community, diagnostic visit), LCU"
			cap label var LCU_tc_com_diagnosticvisit "Total cost (Community, diagnostic visit), LCU"
			cap label var USD_uc_com_LTFUtracing "Unit cost (Community, lost-to-follow-up tracing), USD"
			cap label var LCU_uc_com_LTFUtracing "Unit cost (Community, lost-to-follow-up tracing), LCU"
			cap label var USD_tc_com_LTFUtracing "Total cost (Community, lost-to-follow-up tracing), USD"
			cap label var LCU_tc_com_LTFUtracing "Total cost (Community, lost-to-follow-up tracing), LCU"
			cap label var USD_uc_oth_RNTCPwork "Unit cost (Other, RNTCP work), USD"
			cap label var USD_tc_oth_RNTCPwork "Total cost (Other, RNTCP work), USD"
			cap label var LCU_uc_oth_RNTCPwork "Unit cost (Other, RNTCP work), LCU"
			cap label var LCU_tc_oth_RNTCPwork "Total cost (Other, RNTCP work), LCU"
			cap label var USD_uc_oth_otherTBServices "Unit cost (Other TB services), USD"
			cap label var USD_tc_oth_otherTBServices "Total cost (Other TB services), USD"
			cap label var LCU_uc_oth_otherTBServices "Unit cost (Other TB services), LCU"
			cap label var LCU_tc_oth_otherTBServices "Total cost (Other TB services), LCU"
			cap label var q_oth_otherTBServices "Quantity (Other TB services), USD"
			cap label var q_oth_otherTBServices "Quantity (Other TB services)"
			cap label var USD_uc_lab_LAMP "Unit cost (Laboratory, LAMP), USD"
			cap label var LCU_uc_lab_LAMP "Unit cost (Laboratory, LAMP), LCU"
			cap label var USD_tc_lab_LAMP "Total cost (Laboratory, LAMP), USD"
			cap label var LCU_tc_lab_LAMP "Total cost (Laboratory, LAMP), LCU"
			cap label var USD_uc_lab_DST_SL_solid "Unit cost (Laboratory, DST for second-line, (fluoroquinolone injectables), solid), USD"
			cap label var LCU_uc_lab_DST_SL_solid "Unit cost (Laboratory, DST for second-line, (fluoroquinolone injectables), solid), LCU"
			cap label var USD_tc_lab_DST_SL_solid "Total cost (Laboratory, DST for second-line, (fluoroquinolone injectables), solid), USD"
			cap label var LCU_tc_lab_DST_SL_solid "Total cost (Laboratory, DST for second-line, (fluoroquinolone injectables), solid), LCU"
			cap label var USD_uc_lab_creatinineclearance "Unit cost (Laboratory, creatinine clearance), USD"
			cap label var LCU_uc_lab_creatinineclearance "Unit cost (Laboratory, creatinine clearance), LCU"
			cap label var USD_tc_lab_creatinineclearance "Total cost (Laboratory, creatinine clearance), USD"
			cap label var LCU_tc_lab_creatinineclearance "Total cost (Laboratory, creatinine clearance), LCU"
			cap label var USD_uc_lab_lacticacid "Unit cost (Laboratory, lactic acid), USD"
			cap label var LCU_uc_lab_lacticacid "Unit cost (Laboratory, lactic acid), LCU"
			cap label var USD_tc_lab_lacticacid "Total cost (Laboratory, lactic acid), USD"
			cap label var LCU_tc_lab_lacticacid "Total cost (Laboratory, lactic acid), LCU"
			cap label var USD_uc_lab_lipase "Unit cost (Laboratory, lipase), USD"
			cap label var LCU_uc_lab_lipase "Unit cost (Laboratory, lipase), LCU"
			cap label var USD_tc_lab_lipase "Total cost (Laboratory, lipase), USD"
			cap label var LCU_tc_lab_lipase "Total cost (Laboratory, lipase), LCU"
			cap label var USD_uc_lab_TSH "Unit cost (Laboratory, thyroid stimulating hormone), USD"
			cap label var USD_tc_lab_TSH "Total cost (Laboratory, thyroid stimulating hormone), USD"
			cap label var LCU_uc_lab_TSH "Unit cost (Laboratory, thyroid stimulating hormone), LCU"
			cap label var LCU_tc_lab_TSH "Total cost (Laboratory, thyroid stimulating hormone), LCU"
			cap label var USD_uc_lab_fineneedlebiopsy "Unit cost (Laboratory, fine needle biopsy), USD"
			cap label var USD_tc_lab_fineneedlebiopsy "Total cost (Laboratory, fine needle biopsy), USD"
			cap label var LCU_uc_lab_fineneedlebiopsy "Unit cost (Laboratory, fine needle biopsy), LCU"
			cap label var LCU_tc_lab_fineneedlebiopsy "Total cost (Laboratory, fine needle biopsy), LCU"
			cap label var USD_uc_lab_gastriclavage "Unit cost (Laboratory, gastric lavage), USD"
			cap label var USD_tc_lab_gastriclavage "Total cost (Laboratory, gastric lavage), USD"
			cap label var LCU_uc_lab_gastriclavage "Unit cost (Laboratory, gastric lavage), LCU"
			cap label var LCU_tc_lab_gastriclavage "Total cost (Laboratory, gastric lavage), LCU"
			cap label var USD_uc_lab_bronchiallavage "Unit cost (Laboratory, bronchial lavage), USD"
			cap label var LCU_uc_lab_bronchiallavage "Unit cost (Laboratory, bronchial lavage), LCU"
			cap label var USD_tc_lab_bronchiallavage "Total cost (Laboratory, bronchial lavage), USD"
			cap label var LCU_tc_lab_bronchiallavage "Total cost (Laboratory, bronchial lavage), LCU"
			cap label var USD_uc_lab_smearpreparation "Unit cost (Laboratory, smear preparation), USD"
			cap label var USD_tc_lab_smearpreparation "Total cost (Laboratory, smear preparation), USD"
			cap label var LCU_tc_lab_smearpreparation "Total cost (Laboratory, smear preparation), LCU"
			cap label var LCU_uc_lab_smearpreparation "Unit cost (Laboratory, smear preparation), LCU"
			cap label var USD_uc_lab_viralload "Unit cost (Laboratory, viral load), USD"
			cap label var LCU_uc_lab_viralload "Unit cost (Laboratory, viral load), LCU"
			cap label var USD_tc_lab_viralload "Total cost (Laboratory, viral load), USD"
			cap label var LCU_tc_lab_viralload "Total cost (Laboratory, viral load), LCU"
			cap label var q_lab_EID "Unit cost (Laboratory, early infant diagnosis), USD"
			cap label var q_lab_EID "Quantity (Laboratory, early infant diagnosis)"
			cap label var USD_uc_lab_EID "Unit cost (Laboratory, early infant diagnosis), USD"
			cap label var USD_tc_lab_EID "Total cost (Laboratory, early infant diagnosis), USD"
			cap label var LCU_tc_lab_EID "Total cost (Laboratory, early infant diagnosis), LCU"
			cap label var LCU_uc_lab_EID "Unit cost (Laboratory, early infant diagnosis), LCU"
			cap label var USD_uc_lab_TBCulture "Unit cost (Laboratory, TB culture), USD"
			cap label var USD_tc_lab_TBCulture "Total cost (Laboratory, TB culture), USD"
			cap label var LCU_uc_lab_TBCulture "Unit cost (Laboratory, TB culture), LCU"
			cap label var LCU_tc_lab_TBCulture "Total cost (Laboratory, TB culture), LCU"
			cap label var USD_uc_lab_LFT_UEC "Unit cost (Laboratory, liver function tests, urea and electrolytes), USD"
			cap label var USD_tc_lab_LFT_UEC "Total cost (Laboratory, liver function tests, urea and electrolytes), USD"
			cap label var LCU_uc_lab_LFT_UEC "Unit cost (Laboratory, liver function tests, urea and electrolytes), LCU"
			cap label var LCU_tc_lab_LFT_UEC "Total cost (Laboratory, liver function tests, urea and electrolytes), LCU"
			cap label var USD_uc_lab_haematological "Unit cost (Laboratory, full haemogram and erythrocyte sedimentation rate), USD"
			cap label var LCU_uc_lab_haematological "Unit cost (Laboratory, full haemogram and erythrocyte sedimentation rate), LCU"
			cap label var USD_tc_lab_haematological "Total cost (Laboratory, full haemogram and erythrocyte sedimentation rate), USD"
			cap label var LCU_tc_lab_haematological "Total cost (Laboratory, full haemogram and erythrocyte sedimentation rate), LCU"
			cap label var USD_uc_lab_DBS "Unit cost (Laboratory, dried blood spot test), USD"
			cap label var LCU_uc_lab_DBS "Unit cost (Laboratory, dried blood spot test), LCU"
			cap label var USD_tc_lab_DBS "Total cost (Laboratory, dried blood spot test), USD"
			cap label var LCU_tc_lab_DBS "Total cost (Laboratory, dried blood spot test), LCU"
			cap label var USD_uc_lab_RBS "Unit cost (Laboratory, random blood sugar), USD"
			cap label var LCU_uc_lab_RBS "Unit cost (Laboratory, random blood sugar), LCU"
			cap label var USD_tc_lab_RBS "Total cost (Laboratory, random blood sugar), USD"
			cap label var LCU_tc_lab_RBS "Total cost (Laboratory, random blood sugar), LCU"
			cap label var USD_uc_lab_BHIagar "Unit cost (Laboratory, brain heart infusion agar), USD"
			cap label var LCU_uc_lab_BHIagar "Unit cost (Laboratory, brain heart infusion agar), LCU"
			cap label var USD_tc_lab_BHIagar "Total cost (Laboratory, brain heart infusion agar), USD"
			cap label var LCU_tc_lab_BHIagar "Total cost (Laboratory, brain heart infusion agar), LCU"
			cap label var USD_uc_lab_transportofblood "Unit cost (Laboratory, transport of blood sample), USD"
			cap label var LCU_uc_lab_transportofblood "Unit cost (Laboratory, transport of blood sample), LCU"
			cap label var USD_tc_lab_transportofblood "Total cost (Laboratory, transport of blood sample), USD"
			cap label var LCU_tc_lab_transportofblood "Total cost (Laboratory, transport of blood sample), LCU"
			cap label var q_lab_transportofblood "Quantity (Laboratory, transport of blood sample), USD"
			cap label var q_lab_transportofblood "Quantity (Laboratory, transport of blood sample)"
			cap label var USD_uc_rad_Cardioultrasound "Unit cost (Radiology, ultrasound), USD"
			cap label var LCU_uc_rad_Cardioultrasound "Unit cost (Radiology, ultrasound), LCU"
			cap label var USD_tc_rad_Cardioultrasound "Total cost (Radiology, ultrasound), USD"
			cap label var LCU_tc_rad_Cardioultrasound "Total cost (Radiology, ultrasound), LCU"
			cap label var tcost_LCU "Total cost per patient episode, LCU"
			cap label var tcost_USD "Total cost per patient episode, USD"
			cap label var totalcost_opvisits "Total cost for outpatient visits per patient episode"
			cap label var totalcost_ipvisits "Total cost for inpatient visits per patient episode"
			cap label var totalcost_cmvisits "Total cost for community visits per patient episode"
			cap label var totalcost_othervisits "Total cost for other visits per patient episode"
			cap label var totalcost_labtests "Total cost for laboratory tests per patient episode"
			cap label var totalcost_radiology "Total cost for radiology per patient episode"
			cap label var totalq_opvisits "Total quantity for outpatient visits per patient episode"
			cap label var totalq_ipvisits "Total quantity for inpatient visits per patient episode"
			cap label var totalq_cmvisits "Total quantity for community visits per patient episode"
			cap label var totalq_othervisits "Total quantity for other visits per patient episode"
			cap label var totalq_labtests "Total quantity for laboratory tests per patient episode"
			cap label var totalq_radiology "Total quantity for radiology per patient episode"
		}
		
		
/* Finally we save this dataset as 'Patient' */

		save "Analysis/`date_string'/pooled dataset_patient.dta", replace
		export excel using "Analysis/`date_string'/data export_`date_string'.xlsx", sheet("patient") sheetreplace firstrow(variables)

		
		

*******************************************************************************
*******************************************************************************
*******   Compiling and cleaning the pooled dataset - TREATMENT COSTS   *******
*******************************************************************************
*******************************************************************************


/* We transform the patient dataset here by collapsing treatment costs to one observation for the entire episode of treatment (including both intensive and continuation phases), to facilitate some analysis and make generation of graphs etc easier */

	use "Analysis/`date_string'/pooled dataset_patient.dta", clear
	keep if int_class == "TB TREATMENT"
	
	collapse (sum) q_* LCU_tc_* USD_tc_* tcost_USD tcost_LCU totalcost_* totalq_*, by(fc_country fc_code fc_geog1 fc_type fc_ownership fc_size_m2 fc_beds_total fc_beds_TB fc_opvisits_TB fc_catchmentpop fc_clinicalstaff_FTE fc_supportstaff_FTE fc_totalstaff_FTE int_class int_type int_pop1 int_pop2 int_pop3 int_regimen met_TDvBU met_FINvECON int_detail )

	save "Analysis/`date_string'/pooled dataset_treatcollapsed.dta", replace
	export excel using "Analysis/`date_string'/data export_`date_string'.xlsx", sheet("treat_collapsed") sheetreplace firstrow(variables)


	
